hallo zusammen,
ich habe gerade ein sript geschrieben, bei dem als ergebnis ein pdf rausplumst. Dieses PDF würde ich gerne zur anzeige bringen, aber wenn ich dem script sage:
'PDF Öffnen
Dim intRun As Integer
intRun = Shell(strPrintPath,3)
Bekomme ich als Rückgabe immer ne 0
???
So habe noch ein bisschen google bemüht und bin zu folgendem ergebnis gekommen
strCommand = {start AcroRd32.exe }+ strPrintPath
intRun = Shell(strCommand,3)
wenn ich den strCommand einfach in der cmd eingebe, startet er den acrobatreader mit dem gewünschten pdf, wenn ich das ganze per skript absetze nicht. ist doch zum Mäuse melken
Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (Byval lpFile As String, Byval lpDirectory As String, Byval sResult As String) As Long
Function FindExecutableByExtension( FullPath As String ) As Variant
'// Finds the location of an application for a file
'// Called by : Sub DetachAndEdit
'// Calls : none
Dim success&, pos&, sResult$, RetVal$, lpFile$, lpDirectory$, msg$
sResult = Space$ ( MAX_PATH )
lpFile$ = ExtractFileName ( FullPath )
lpDirectory$ = Left$ ( FullPath , Len( FullPath ) - Len( lpFile$ ) )
success = FindExecutable ( lpFile$ , lpDirectory$ , sResult )
Select Case success
Case ERROR_FILE_NO_ASSOCIATION: msg = "no association"
Case ERROR_FILE_NOT_FOUND: msg = "file not found"
Case ERROR_PATH_NOT_FOUND: msg = "path not found"
Case ERROR_BAD_FORMAT: msg = "bad format"
Case Is >= ERROR_FILE_SUCCESS:
pos = Instr ( sResult , Chr$ ( 0 ) )
If pos Then RetVal = Left$ ( sResult , pos - 1 )
End Select
FindExecutableByExtension = RetVal
End Function
Ist aus meiner alten clsAttachment aus der Sandbox.