A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Open and print image file from form programmaticaly



 
 
Thread Tools Display Modes
  #1  
Old October 13th, 2006, 03:43 AM posted to microsoft.public.access.forms
shoostry343
external usenet poster
 
Posts: 2
Default Open and print image file from form programmaticaly

Hi, Gentlemen!
I am sorry in advance for a long intro.
I am not very familiar with VBA and would greatly appreciate if anyone
could assist me anyhow in solving the following problem.
I need to open and print *.tif image files from MS Access form (using
of other image file type is possible if it does the job).
The task is to print a number of images complementing each other and
referring to a record, on a click of a button. I decided to use
tif-image-type as this is the only image type I know of that can store
more than one image in one file (I could have used a corresponding
folder to store images of one record in, but I do not know how to
programmatically create a folder with a particular name for each
record, and folder-method is not preferred).
I have a code that ideally should work for the type of operation I
need, but it does not work the way it should. I will list the code
below and explain what I have tried to resolve the problem.
If anyone has any ideas on this issue - I would really appreciate any
help or any suggestions.
The code:

Option Compare Database

Private Declare Function apiShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hWnd As Long, _
ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long


Private Sub PrintImage_Click()
Dim a As Variant
a = Me!StockNumber
Call apiShellExecute(hWndAccessApp, "Print", _
"C:\" & a & ".tif", 0&, 0&, 1)
End Sub


So far I've tried to print into the following programs: Microsoft
Office Document Imaging, Windows Picture and Fax Viewer, Microsoft
Photo Editor, Lexmark Photo Editor. Some of the mentioned programs
opened the files but just did not print and some did not even open even
though all of them open and print fine through direct use.
I also tried to add or edit system actions and application references
in "Edit file type" window of windows file association menu (for
example, MS Office Document Imaging did not have "print" action
assigned therefore it did not react to "print" command from
"ShellExecuteA", but after I added the action the program returned
a critical error).
But nothing worked so far.

If anyone knows of any replacement for "ShellExecuteA" or have any
ideas on how to resolve an issue - please help!
Thank you!

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:09 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.