Opening Paint From Within Acces

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a database that stores the pathname pictures in certain fields, and on
my form I have small thumbnails of those pictures.
My users want to be able to print out the full size pictures if necessary.
My idea is to use code to open up MSPaint and pass the name of the file to
paint so that they can print the picture, but I'm not sure how to achieve
this.
Alternatively, is there any way I can print them directly from Access at
their original size?

Thanks


Neil
 
Hi Neil,

Try something like

Dim strPaint As String
Dim strPicture As String

strPaint = Environ("SYSTEMROOT") & "\System32\mspaint.exe"
strPicture = "C:\folder\file.bmp"

Shell """" & strPaint & """ """ & strPicture & """", _
vbNormalFocus

If you add /p before the final quotation mark, e.g.
... strPicture & """ /p",
Paint will send the picture straight to the default printer.

That's for using Paint regardless of the user's preferences. If instead
you use something like this:

Dim strPicture As String

strPicture = "C:\folder\file.bmp"
Application.FollowHyperlink strPicture

it will open the picture in whatever is the user's default program for
files of that type.

hell("""C:\Windows\System32\mspaint.exe"" ""C:\Documents and
Settings\John Nurick\My Documents\My Pictures\People.gif""")
 
Back
Top