Custom message box on API

D

Dave

I am using the "Call the standard Windows File Open/Save dialog box"
API by Ken Getz found at http://www.mvps.org/access/api/api0001.htm.
Everything seems to be working just fine, however when a file name is
typed into the File name: field that doesn't exist, a message box
appears stating:

<<What your just typed in>>
File not found.
Please verify the correct file name was given.

I was just wondering if it's possible to create a custom message here
instead. I cannot find the code that generates this message.

Thanks!
 
B

Brendan Reynolds

The code that generates that message is in the DLL, rather than in the VBA
code that calls the DLL, so you can't change that.

I haven't tested this, but I believe that the modification I'm about to
describe below should allow the VBA code to run without error and return the
file name even if the file does not exist. You'd then have to add your own
code to test whether the file exists and display your custom error message
if it doesn't.

Original code ...
lngFlags = ahtOFN_FILEMUSTEXIST Or _
ahtOFN_HIDEREADONLY Or ahtOFN_NOCHANGEDIR

Modified code ...
lngFlags = ahtOFN_HIDEREADONLY Or ahtOFN_NOCHANGEDIR

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top