I suspect the bitness is of no concern because you say (I think) that the code fails on a particular line. IIRC, any issues with 64 vs 32 would arise as soon as the "unsafe" API's are referenced or compiled? You could use the standard method of troubleshooting - put a break point on the start of the code and initiate the event that runs it (e.g. button click). Then you step through line by line (F8) and follow the process, checking variables and/or the results of calculations/checks as you go. You can simply mouse over a variable to see its value. Note that when the execution is on a line (it is highlighted) it has not been processed so any variable will still have the value it had up to that point. You need to move off the line to see the result of whatever that line does. The code you eventually found seems to branch off again (GetOpenFileName) so I think no one is any farther ahead yet.
Another thing you can do is check your references. If you switch from 32 to 64, you likely are now using a higher version of Office or at least Access and there could be a missing reference now.
P.S. would be much appreciated if you would post code between code tags (# on posting toolbar) with proper indentation to make it easier to read. Example:
Code:
Public Function BrowseOpen() As String
Dim OFName As OPENFILENAME
OFName.lStructSize = Len(OFName)
OFName.lpstrFilter = "Excel Files (*.xlsx)" + Chr$(0) + "*.xlsx" '"Excel Files (*.csv)" + Chr$(0) + "*.csv" '+ Chr$(0) ' +
OFName.lpstrFile = Space$(999)
OFName.nMaxFile = 1000
OFName.lpstrFileTitle = Space$(999)
OFName.nMaxFileTitle = 1000
OFName.lpstrInitialDir = "..\Desktop"
OFName.lpstrTitle = "File Open Browser"
OFName.flags = 0
If GetOpenFileName(OFName) Then
BrowseOpen = Trim$(OFName.lpstrFile)
'BrowseOpen = Trim$(Left$(OFName.lpstrFile, Len(OFName.lpstrFile) - 2))
'buff = Trim$(Left$(OFN.sFile, Len(OFN.sFile) - 2))
Else
BrowseOpen = ""
End If
End Function
Last edited by Micron; 07-21-2021 at 11:29 AM.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.