Open jpeg file with MS Picture Manager from db A2003

G

Guest

I am using the Common FileOpen Dialog together with Shell Execute to open a
jpeg file from the folder called “Images†in the directory containing the
database.
I have code to open MS Picture Manager from db.

Please point me to how I can combine both sets of code to open the jpeg
files with MS Picture Manager by browsing to the folder called “Images†in
the directory containing the database.

Folder “Images†contains subfolders for photos arranged according to track
name and year. The reason for using MS Picture Manager is to see either
thumbnails or the filmstrip view for easy navigation to all the photos for
the selected folder.

See code below


Dim stAppName As String
Dim strFilter As String
Dim strInputFileName As String


' Open a file dialog box for jpeg and bmp files
strFilter = ahtAddFilterItem _
(strFilter, "Jpeg Files (*.jpg)", "*.JPG")
strFilter = ahtAddFilterItem _
(strFilter, "Windows Bitmap Files (*.bmp)", "*.BMP")

'set FileOpenSave to open at the folder called
‘Images in the database directory
'set the text for the title of the FileOpen dialog box
'set the initial directory to where the
‘database is located on user's computer
'Now actually call to get the file name.
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, _
OpenFile:=True, _
InitialDir:=CurrentProject.Path & "\Images", _
DialogTitle:="Select the picture to open..", _
Flags:=ahtOFN_HIDEREADONLY)

Call fHandleFile(strInputFileName, WIN_MAX)
**
The code below will start Picture manager from the database,
but only opens to the last used folder.
stAppName = "C:\Program Files\Microsoft Office\OFFICE11\OIS.EXE"
Call Shell(stAppName, vbNormalFocus)
**
How to combine with the code above to open the specified file?
 
D

Douglas J. Steele

You need to pass the name of the file when you shell out to Picture Manager.
In order to handle the possiblities of spaces in the file name, you need to
enclose it in quotes. Try something like:

If Len(strInputFileName) > 0 Then
stAppName = "C:\Program Files\Microsoft Office\OFFICE11\OIS.EXE " &
_
Chr$(34) & strInputFileName & Chr$(34)
Call Shell(stAppName, vbNormalFocus)
End If

I'm checking the length of strInputFileName to ensure that you actually
selected a file in the dialog. Note the blank after .EXE when definining
stAppName
 

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