1.9k Aufrufe
Gefragt in Tabellenkalkulation von
Hallo, ich habe folgendes Problem und komme einfach nicht weiter...
ich habe ein makro was unter Office 32bit sehr gut läuft aber unter
64bit zeigt er mir einen fehler an ( Kompilierungsfehler )

Danke schon ein mal für eure hilfe !!!


Private Sub CommandButton13_Click()
'PDF.....001
Dim strDatei As String
strDatei = "C:\Test\001test.pdf"
ShellExecute 0, "Print", strDatei, "", "", 0
End Sub


und....

' **********************************************************************
' Modul: Modul1 Typ: Allgemeines Modul
' **********************************************************************

Option Explicit

Public 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

10 Antworten

0 Punkte
Beantwortet von
ShellExecute Lib "shell32.dll"


das sagt doch schon alles. du kannst diese funktion nicht verwenden sondern musst die passende 64bit alternative finden
0 Punkte
Beantwortet von
ja aber das ist ja mein problem... :(
es muß auf beiden laufen !!!!
0 Punkte
Beantwortet von
versuchs mal mit
... Declare PtrSafe ...
0 Punkte
Beantwortet von nighty Experte (6.6k Punkte)
hi all ^^

ergänze deine makros mit
einem weiteren modul auf 64 bit basis

und ergänze das hauptmodul

mit einer abfrage auf 32/64 bit

die abfrage könnte dann so aussehen

If VBA7 Then
Call Modulname64bit
Else
Call Modulname32bit
End If


gruss nighty
0 Punkte
Beantwortet von
hallo, wie würde es den Aussehen das Makro..?!

ergänze deine makros mit
einem weiteren modul auf 64 bit basis


und ergänze das hauptmodul

mit einer abfrage auf 32/64 bit

die abfrage könnte dann so aussehen
0 Punkte
Beantwortet von nighty Experte (6.6k Punkte)
hi nero000022 ^^

leider keine zeit zm einarbeiten und die Umgebung fehlt mir auch zur zeit
sollte auch nur Wegweiser sein

bei libs ist nepumuk aus dem Office Forum ein echter künstler

bitte ihn dir zu helfen nepumuk macht das im schlaf :-)

http://www.ms-office-forum.net/forum/showthread.php?t=243499">
http://www.ms-office-forum.net/forum/showthread.php?t=243499

gruss nighty
0 Punkte
Beantwortet von nighty Experte (6.6k Punkte)
hi all ^^

vorweg
ich kenn mich nicht mit der lib aus

daher nur ein Ansatz

Private Sub CommandButton13_Click()
If VBA7 Then
Call Modul64bit
Else
Call Modul32bit
End If
End Sub


Variable ist local
Private Declare Function ShellExecute Lib "shell64.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
Sub Modul64bit()
Dim strDatei As String
strDatei = "C:\Test\001test.pdf"
ShellExecute 0, "Print", strDatei, "", "", 0
End Sub


Variable ist local
Private 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
Sub Modul32bit()
Dim strDatei As String
strDatei = "C:\Test\001test.pdf"
ShellExecute 0, "Print", strDatei, "", "", 0
End Sub


alle module sind separat zu halten

gruss nighty
0 Punkte
Beantwortet von
es gibt keine "shell64.dll"

du musst die shell32.dll verwenden und im Kompatibilitätsmodus deklarieren
wie schon erwähnt mit "Declare PtrSafe"

also
Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias .......
0 Punkte
Beantwortet von nighty Experte (6.6k Punkte)
hi declare ^^

dann ist das prob ja längst gelöst *g*

danke für die info :-)

gruss nighty
0 Punkte
Beantwortet von nighty Experte (6.6k Punkte)
hi nero000022 ^^

das geaenderte modul mit dem tip von declare :-)

Private Declare PtrSafe 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
Sub Modul64bit()
Dim strDatei As String
strDatei = "C:\Test\001test.pdf"
ShellExecute 0, "Print", strDatei, "", "", 0
End Sub


jetzt sollte es funktionieren bei beiden Versionen

wichtig ist noch das du bei einfügen modul im vbed
auch 3 mal ein modul erstellst das die variablen local bleiben

gruss nighty
...