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.
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.