ich möchte eine Word-Datei per Excel-Vba öffnen. Und dies auf Fremdrechnern. Man weiß also nicht wo die word.exe (winword.exe?) steckt. Erschwerend kommt dazu, es ist gar nicht gesagt daß dort Word vorhanden ist, kann auch OpenOffice sein.
M.E. scheidet dadurch "Shell" aus.
Jetzt kannte ich aber die API-Funktion "ShellExecute" und dachte der langt der Doc-Dateiname.
Aber Pustekuchen, ich stehe staunend vor
http://support.microsoft.com/kb/238245/de
bzw. dem nachfolgenden Code.
Was bedeutet denn da bitteschön "OPUSAPP"? U.v.m.
Wie könnte man die Problematik lösen?
Danke ^ Gruß
Reinhard
Hier der Code von MS:
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
Declare Function apiFindWindow Lib "User32" Alias "FindWindowA" _
(ByVal lpclassname As Any, ByVal lpCaption As Any) As Long
Global Const SW_SHOWNORMAL = 1
Sub ShellExecuteExample()
Dim hwnd
Dim StartDoc
hwnd = apiFindWindow("OPUSAPP", "0")
StartDoc = ShellExecute(hwnd, "open", "C:\My Documents\Book1.xls", "", _
"C:\", SW_SHOWNORMAL)
End Sub