Open jpeg file with MS Picture Manager from db A2003

March 28th, 2005 - 05:19 am ET by Liz James | Report spam
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?
email Follow the discussionReplies 1 replyReplies Make a reply

Similar topics

Replies

#1 Douglas J. Steele
March 28th, 2005 - 08:17 am ET | Report spam
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


Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"Liz James" wrote in message
news:
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?



email Follow the discussion Replies Reply to this message
Help Create a new topicReplies Make a reply
Search Make your own search