Hey,
My Acrobat Reader was replaced today by Acrobat Reader 2017, now that I can no longer run my VBA script to help my iemad user?
__________________________________________
Option Explicit
Option Compare Text
'System-Konstanten für Acrobat Reader
Private Const iHKCU = &H80000001
Private Const iHKLM = &H80000002
Private Const sRegKey = "Software\Adobe\Acrobat Reader\"
Private Const sExeValue = "\Adobe\Reader %1\Reader\AcroRd32.Exe"
Private Const sExeSql = "Select * from Win32_Process Where Name='AcroRd32.Exe'"
Private Const sWinMan = "winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2"
Private Const sWinReg = "winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv"
'Diese Function ermittelt den Programm-Pfad vom AcrobatReader
Public Function GetAcroReaderPath() As String
Dim intHKey As Variant, aValues As Variant, sValue As String, strAcroPath As String
With GetObject(sWinReg)
For Each intHKey In Array(iHKCU, iHKLM)
.EnumKey intHKey, sRegKey, aValues
If IsArray(aValues) Then
If IsNumeric(aValues(0)) Then sValue = aValues(0)
End If
Next
End With
If sValue <> "" Then
strAcroPath = Environ("ProgramFiles") & Replace(sExeValue, "%1", sValue)
With CreateObject("Scripting.FileSystemObject")
If .FileExists(strAcroPath) = False Then strAcroPath = ""
End With
GetAcroReaderPath = strAcroPath
End If
End Function
'Diese Function schließt den AcrobatReader
Public Sub CloseAcroPdfFiles()
Dim objProcess As Object
For Each objProcess In GetObject(sWinMan).ExecQuery(sExeSql)
objProcess.Terminate
Next
End Sub
______________-
thank you for the help
Bookmarks