Hi all.
I am currently in the process of migrating my organization from V8i to Connect. This includes the VBA that have been written over the years, most have been a non issue but there are some that used the Ken Getz code to call the cmdlg32.dll api to open and process a file, that draws out a bridge plot based on an in house geometry. I have gone through an added the needed PtrSafe to the declare function:
Declare PtrSafe Function aht_apiGetOpenFileName Lib "comdlg32.dll" _ Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As Boolean
I have gone through and changed the declaration of tagOPENFILE name to:
Type tagOPENFILENAME lStructSize As Long hwndOwner As LongPtr hInstance As LongPtr lpstrFilter As String lpstrCustomFilter As String nMaxCustFilter As Long nFilterIndex As Long lpstrFile As String nMaxFile As Long lpstrFileTitle As String nMaxFileTitle As Long lpstrInitialDir As String lpstrTitle As String flags As Long nFileOffset As Integer nFileExtension As Integer lpstrDefExt As String lCustData As Long lpfnHook As LongPtr lpTemplateName As StringEnd Type
I have gotten the program to run and not crash. But it fails to open the called dialog box. I have tried every different option I came across in my searches and nothing has worked. If anyone has another method to call an open file dialog in VBA or any suggestion on getting this to work it would be appreciated. My other option is to convert this program to .Net
good morning I apologize for my poor English, I do not know if I have understood the problem, but I enclose a macro that could solve the problemapre_file.mvba
regards
Your code is written in perfect english! I've had to throw variable names at google to try and decipher code from other non-english programmers. I'm not complaining, mind you as its not a good idea to look a gift horse in the mouth.
I'll have to plug this in to my code, but it looks great!!!! Thanks again!
Charles (Chuck) Rheault CADD Manager
MDOT State Highway Administration