-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Here's a quick fix for making it work on 64 bit Excel.
I haven't had time to really dig in and see if this is the full fix, but at least the code is running with this change.
Edit the top to the UsefulStuff Module down to and not including "Public Const cFailedtoGetHandle = -1" line :
Option Explicit
' note original execute shell stuff came from this post
' http://stackoverflow.com/questions/3166265/open-an-html-page-in-default-browser-with-vba
' thanks to http://stackoverflow.com/users/174718/dmr
' Updated to support 64 bit excel, based on https://stackoverflow.com/questions/5506912/how-should-i-make-my-vba-code-compatible-with-64-bit-windows
#If Win64 Then
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
#Else
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
#End If
' note Acknowledgement URI encode stuff came from this post
' http://stackoverflow.com/questions/218181/how-can-i-url-encode-a-string-in-excel-vba
' thanks to http://stackoverflow.com/users/4023/matthew-murdoch
' Updated to support 64 bit excel, https://stackoverflow.com/questions/21982682/code-does-not-work-on-64-bit-office
Private Const CP_UTF8 = 65001
#If Win64 Then
Private Declare PtrSafe Function WideCharToMultiByte Lib "Kernel32" ( _
ByVal CodePage As LongPtr, ByVal dwflags As LongPtr, _
ByVal lpWideCharStr As LongPtr, ByVal cchWideChar As LongPtr, _
ByVal lpMultiByteStr As LongPtr, ByVal cchMultiByte As LongPtr, _
ByVal lpDefaultChar As LongPtr, ByVal lpUsedDefaultChar As LongPtr) As LongPtr
#Else
Private Declare Function WideCharToMultiByte Lib "kernel32" ( _
ByVal CodePage As Long, ByVal dwflags As Long, _
ByVal lpWideCharStr As Long, ByVal cchWideChar As Long, _
ByVal lpMultiByteStr As Long, ByVal cchMultiByte As Long, _
ByVal lpDefaultChar As Long, ByVal lpUsedDefaultChar As Long) As Long
#End If
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels