ich habe folgendes Problem: Ich habe ein Makro erstellt, welches mir eine automatische PDF erzeugt und dann unter einem Pfad abspeichert. Dieses Makro funktioniert auch, wenn eine 32 bit Version vorhanden ist. Bei einer 64 bit Version kommt die Kompilierungsfehlermeldung, dass der Code auf 64 bit Version aktualisiert werden muss. Ich denke es liegt an der API Dekleration...Kann mir hier jemand weiterhelfen?
Hier mein Code:
Option Explicit
'API Deklaration~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" ( _
ByVal DirPath As String) As Long
'Ende API Deklaration~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'PDF erstellen (MEI)
Private Sub CommandButton1_Click()
Dim strFileName As String
Dim strPath As String
Dim result As Long
strPath = "I:\Desktop\arek\1\" & "\" & Range("A3").Text & "\"
result = MakeSureDirectoryPathExists(strPath)
If result 0 Then
strFileName = strPath & Range("C31") & "_" & Range("B2")
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=strFileName, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Else
MsgBox "Verzeichnis kann nicht erstellt werden!" & vbLf & strPath, 48, "Hinweis"
End If
End Sub
'PDF erstellen (B)
Private Sub CommandButton2_Click()
Dim strFileName As String
Dim strPath As String
Dim result As Long
strPath = "I:\Desktop\arek\2\" & "\" & Range("A3").Text & "\"
result = MakeSureDirectoryPathExists(strPath)
If result 0 Then
strFileName = strPath & Range("C31") & "_" & Range("B2")
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=strFileName, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Else
MsgBox "Verzeichnis kann nicht erstellt werden!" & vbLf & strPath, 48, "Hinweis"
End If
End Sub