You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can someone knowledgeable in Excel VBA help us out?
Sone users get compile errors on the following block of code in pscf.xla
If VBA7 Then
Public Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As LongPtr, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As LongPtr
Else
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
End If
...
On Error GoTo 0
Print #1, "locked"
Close #1
Dim args As String
args = arg1 & " " & arg2 & " " & arg3 & " " & arg4 & " " & arg5 & " " & arg6 & " " & arg7
Dim inst As Long
inst = ShellExecute(0, "open", spec, args, work_dir, 0)
If inst <= 32 Then
MsgBox work_dir & ", " & spec
End If
On Error GoTo done:
We need to be able to reliably shell out to Windows under both 32 and 64 bit.
The text was updated successfully, but these errors were encountered:
Hi Marc,
I'm not very knowledgable in Excel, but just by looking at the code, it
seems like the following line could cause compile time error due to return
type mismatch:
Dim inst As Long
inst = ShellExecute(0, "open", spec, args, work_dir, 0)
For VBA7, there would be a mismatch between the function return type of
LongPtr vs the variable type Long for inst.
Can someone knowledgeable in Excel VBA help us out?
Sone users get compile errors on the following block of code in pscf.xla
#If VBA7 Then
Public Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" (ByVal hwnd As LongPtr, ByVal lpOperation As String, ByVal
lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As
String, ByVal nShowCmd As Long) As LongPtr
#Else
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
#End If
...
On Error GoTo 0
Print #1#1, "locked"
Close #1#1
Dim args As String
args = arg1 & " " & arg2 & " " & arg3 & " " & arg4 & " " & arg5 & " " &
arg6 & " " & arg7
Dim inst As Long
inst = ShellExecute(0, "open", spec, args, work_dir, 0)
If inst <= 32 Then
MsgBox work_dir & ", " & spec
End If
On Error GoTo done:
We need to be able to reliably shell out to Windows under both 32 and 64
bit.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/13.
Can someone knowledgeable in Excel VBA help us out?
Sone users get compile errors on the following block of code in pscf.xla
If VBA7 Then
Public Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As LongPtr, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As LongPtr
Else
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
End If
...
On Error GoTo 0
Print #1, "locked"
Close #1
Dim args As String
args = arg1 & " " & arg2 & " " & arg3 & " " & arg4 & " " & arg5 & " " & arg6 & " " & arg7
Dim inst As Long
inst = ShellExecute(0, "open", spec, args, work_dir, 0)
If inst <= 32 Then
MsgBox work_dir & ", " & spec
End If
On Error GoTo done:
We need to be able to reliably shell out to Windows under both 32 and 64 bit.
The text was updated successfully, but these errors were encountered: