wie kann ich mittels VBA den Pfad der aktuell geöffneten/er PDF Daten in Adobe Reader auslesen?
Vielen Dank vorab.
Grüße
Tom
Sub b()
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'AcroRd32.exe'")
For Each objProcess In colProcessList
Debug.Print objProcess.commandline
Next
End Sub
mfg AntonOption Explicit
Private Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As _
Long) As Boolean
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _
(ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal _
hwnd As Long) As Long
Dim fn As String
Public Sub SucheFenster()
Dim n As Long
fn = "keine"
EnumWindows AddressOf FindWindow, 0&
MsgBox "Geöffnete Datei: " + fn
End Sub
Private Function FindWindow(ByVal lHwnd As Long, ByVal lParam As Long) As Boolean
Dim sTemp As String, retVal As Long, p As Long
retVal = GetWindowTextLength(lHwnd)
sTemp = Space(retVal)
GetWindowText lHwnd, sTemp, retVal + 1
If retVal 0 Then
p = InStr(UCase(sTemp), ".PDF")
If (p > 0) Then fn = Left(sTemp, p + 3): FindWindow = False: Exit Function
End If
FindWindow = True
End Function
Die erweiterte Suchfunktion hilft dir, gezielt die besten Antworten zu finden
Suche nach den besten AntwortenEntdecke unsere meistgeklickten Beiträge in der Google Suche
Top 100 Threads jetzt ansehen