tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,913
- Office Version
- 365
- 2019
- Platform
- Windows
In this article:
it states to convert from 32 bit to 64 bit:
This is the code:
So I suppose it should be changed to:
My question is: why does the "other" Long (at the end of the first line) not need to also change to LongPtr?
In another article:
it states it must change from:
to this:
Furthermore, other than changing APIs (and removing ActiveX objects), what else must one do to make VBA run on both 32 bit and 64 bit Excel?
Thanks
Code:
https://www.py4u.net/discuss/1448003
it states to convert from 32 bit to 64 bit:
Code:
Manually add PtrSafe to all declarations. Manually convert all Longs in the declarations that represent pointers to LongPtrs (in the code shown, that would be only pidl).
Manually update declarations of Long variables in procedures that are passed as these parameters to LongPtr. There's no other way. You may try to look into refactoring tools/addins that may automate the replacements to a degree.
This is the code:
Code:
Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Declare Function SHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
So I suppose it should be changed to:
Code:
Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As LONGPTRS, ByVal pszPath As String) As Long
Declare Function SHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
My question is: why does the "other" Long (at the end of the first line) not need to also change to LongPtr?
In another article:
Code:
https://stackoverflow.com/questions/42557610/how-to-convert-32-bit-vba-code-into-64-bit-vba-code
it states it must change from:
Code:
Private Declare Function GetTimeZoneInformation Lib "kernel32" ( _
lpTimeZoneInformation As TIME_ZONE_INFORMATION) As Long
to this:
Code:
Private Declare PtrSafe Function GetTimeZoneInformation Lib "kernel32" ( _
lpTimeZoneInformation As TIME_ZONE_INFORMATION) As LongPtr
Furthermore, other than changing APIs (and removing ActiveX objects), what else must one do to make VBA run on both 32 bit and 64 bit Excel?
Thanks