I have some old code that works on my home machine but crashes on my office 64-bit macine

I got this one to work but when the second crashed

#If Win64 Then
Private Declare PtrSafe Function GetTempPath Lib "Kernel32" Alias "GetTempPathA"
#Else
Private Declare Function GetTempPath Lib "Kernel32" Alias "GetTempPathA"
#End If
And
But this did not, any idea why?
#If Win64 Then
Declare PrtSafe Function aht_apiGetOpenFileName Lib "comdlg32.dll" _
Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As Boolean
#Else
Declare PtrSafe Function aht_apiGetOpenFileName Lib "comdlg32.dll" _
Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As Boolean
#End If
scsilveraAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gustav BrockCIOCommented:
You are missing some details:

#If Win64 Then
    Private Declare PrtSafe Function aht_apiGetOpenFileName Lib "comdlg32.dll" _
        Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As Long
#Else
    Private Declare Function aht_apiGetOpenFileName Lib "comdlg32.dll" _
        Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As Long
#End If

/gustav
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
scsilveraAuthor Commented:
I'm at home and will test it out tomorrow when I'm back in the office, which is where the crashing occurs.
0
scsilveraAuthor Commented:
It did not work in the office...
#If Win64 Then
   Private Declare PrtSafe Function aht_apiGetOpenFileName Lib "comdlg32.dll" _
    Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As Boolean
    Private Declare PrtSafe Declare Function CommDlgExtendedError Lib "comdlg32.dll" () As Long
#Else
   Private Declare Function aht_apiGetOpenFileName Lib "comdlg32.dll" _
         Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As Long
    Private Declare PrtSafe Declare Function CommDlgExtendedError Lib "comdlg32.dll" () As Long
#End If
When it crashed PrtSafe was highlighted.  The bold text is red of course as displayed with in VBA.

I  get this error message:
Error Message
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Gustav BrockCIOCommented:
Of course. You are still missing a detail.
Look again. Or copy-paste my code.

/gustav
1
scsilveraAuthor Commented:
I corrected the As Boolean to As Long
#If Win64 Then
    Private Declare PrtSafe Function aht_apiGetOpenFileName Lib "comdlg32.dll" _
    Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As Long
    Private Declare PrtSafe Declare Function CommDlgExtendedError Lib "comdlg32.dll" () As Long
#Else
    Private Declare Function aht_apiGetOpenFileName Lib "comdlg32.dll" _
         Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As Long
    Private Declare PrtSafe Declare Function CommDlgExtendedError Lib "comdlg32.dll" () As Long
#End If

But it still crashed at PrtSafe.  What is bizarre it that the code was working fine at home but crashes here even with the As Boolean.  Am I still missing something?  This machine is running Windows 7 Enterprize, I even had the VPN open trying to make thing as similar as possible
0
Gustav BrockCIOCommented:
If you remove the lines with CommDlgExtendedError it will probably not crash.

If so, correct the syntax of these lines to match that of the other declarations.
Again, pay attention to the details.

/gustav
1
scsilveraAuthor Commented:
I'm at a loss, there must be something wrong with this machine... or I just don't see the subtleties.
Crash
0
Gustav BrockCIOCommented:
Oops. It is PtrSafe, not PrtSafe ...

/gustav
1
scsilveraAuthor Commented:
I cannot see the tree for the forest...

I appreciate all you help and patience with me!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.