Browse to image

D

Douglas J. Steele

Create a new module (not a class module, nor a module associated with a form
or report). Copy everything from that page between Code Start and Code End
and paste it into the module you just created. Save the module, making sure
you don't name it the same as any of the routines inside the module (call it
something like mdlFileDialog)

Where you want to call the dialog, use code like:

Dim strFilter As String
Dim strInputFileName as string

strFilter = ahtAddFilterItem(strFilter, "JPEG Files (*.jpg)",
"*.jpg;*.jpeg")
strFilter = ahtAddFilterItem(strFilter, "PNG Files (*.png)", "*.png")
' Etc. for whatever extensions you want to allow
strFilter = ahtAddFilterItem(strFile, "Any file", "*.*")

strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an image...", _
Flags:=ahtOFN_HIDEREADONLY)

strInputFileName will be the full path to the file the user selected: use it
however you need it.
 
D

Douglas J. Steele

That code is not intended for web pages. In fact, I don't believe it'll work
for web pages.

Somehow you have to provide a mechanism to the user to indicate that they
wish to select an image to be associated with a particular record. How you
do that is up to you. You can have them double-click on the record, you can
have them click on a button, you can prompt them when you move from record
to record, or any other option you can think of. Once you've decided what to
use to prompt them, you'd put the code

Dim strFilter As String
Dim strInputFileName as string

strFilter = ahtAddFilterItem(strFilter, "JPEG Files (*.jpg)",
"*.jpg;*.jpeg")
strFilter = ahtAddFilterItem(strFilter, "PNG Files (*.png)", "*.png")
' Etc. for whatever extensions you want to allow
strFilter = ahtAddFilterItem(strFile, "Any file", "*.*")

strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an image...", _
Flags:=ahtOFN_HIDEREADONLY)

in the procedure associated with that event.
 

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

Top