|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Working in EXCEL i have this two similar Sub's:
«Convert» & «EBook» the first one works, but «EBook» doesn't. any help? Thx! ------------------------------------------------------------- Sub Convert() On Error Resume Next ChDir "M:\Utilities" Program = "Convert.exe" TaskID = Shell(Program, 1) On Error GoTo 0 If Err <> 0 Then MsgBox "Cannot start" & Program, vbCritical, "Error" End If End Sub ----------------------------------------- Sub EBook() On Error Resume Next ChDir "G:\My Documents\" Program = "New.pdf" TaskID = Shell(Program,1) On Error GoTo 0 If Err <> 0 Then MsgBox "Cannot start" & Program, vbCritical, "Error" End If End Sub ------------------------------------------ |
|
#2
|
|||
|
|||
|
Oh!"New.pdf" is a document,just not a executable file.So u shouldn't shell it!!..
|
|
#3
|
||||
|
||||
|
My understanding is that Shell (or something further down the chain) will make use of file associations, thus Acrobat Reader should be started in this case.
Daniel: Silly questions, perhaps - is Acrobat Reader installed on the target PC? Does "g:\My Documents\new.pdf" exist? What happens if you double-click on new.pdf in Windows Explorer? |
|
#4
|
|||
|
|||
|
Use ShellExecuteEX function that will run on all windows platform It makes use of the association.
good luck anth |
|
#5
|
|||
|
|||
|
No!NicMic!Shell function couldn't use of file associations!Oly shellexecute and shellexecuteex function can do it!
And everyone who is interested look it: Function introduce: Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long U can visit www.allapi.net for download API-Guide which is a great api search tools! Sample: Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Const SW_SHOWNORMAL = 1 Private Sub Form_Load() 'KPD-Team 1998 'URL: http://www.allapi.net/ 'E-Mail: KPDTeam@Allapi.net 'Send an E-Mail to the KPD-Team ShellExecute Me.hwnd, vbNullString, "mailto:KPDTeam@Allapi.net", vbNullString, "C:\", SW_SHOWNORMAL End Sub |
|
#6
|
||||
|
||||
|
I stand corrected! Thanks for the update.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > SHELL function problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|