CreateObject

J

John Nurick

If you'd scrolled through the list you get when you use the
Tools|References menu command in the VB Editor you would have found the
"Microsoft Office Document Imaging 11.0 Type Library".

Once you've set a reference to a library you can see what it contains by
hitting <F2> to launch the Object Browser. I don't know how to program
MODI; it doesnt' seem to expose an Application object.

However, as a general rule if you want to print a document you can find
out how by going to the Folder Options in Windows Explorer. Switch to
the File Types tab, find the type you're interested in, and click
Advanced... Then select Print and click Edit... Under "Application
used..." you'll usually find a Windows shell command that will do the
job. For TIFF files on my computer, it's

"C:\Program Files\Common Files\Microsoft Shared\MODI\11.0\MSPVIEW.EXE"
/p "%1"

where %1 would be replaced by the file to be printed.

(This information is also available under program control by using API
calls to read the corresponding registry entries).
 
J

JohnFol

PS best to use early binding.


John Nurick said:
If you'd scrolled through the list you get when you use the
Tools|References menu command in the VB Editor you would have found the
"Microsoft Office Document Imaging 11.0 Type Library".

Once you've set a reference to a library you can see what it contains by
hitting <F2> to launch the Object Browser. I don't know how to program
MODI; it doesnt' seem to expose an Application object.

However, as a general rule if you want to print a document you can find
out how by going to the Folder Options in Windows Explorer. Switch to
the File Types tab, find the type you're interested in, and click
Advanced... Then select Print and click Edit... Under "Application
used..." you'll usually find a Windows shell command that will do the
job. For TIFF files on my computer, it's

"C:\Program Files\Common Files\Microsoft Shared\MODI\11.0\MSPVIEW.EXE"
/p "%1"

where %1 would be replaced by the file to be printed.

(This information is also available under program control by using API
calls to read the corresponding registry entries).
 
S

Shadow

thanks for your reply.
I've added Office document to the references but I'm not able to find it in
Object Browser.

I'm trying to print some .tif files through vba in an access database when a
user clicks a print button.
It would be great if you explain how
"C:\Program Files\Common Files\Microsoft Shared\MODI\11.0\MSPVIEW.EXE" /p
"%1"
can be used in vba.


Thanks for your help.

JohnFol said:
PS best to use early binding.
 
D

dan artuso

Hey Shadow,
Can you please fix your system clock? Your in the future, so that means you
posts will remain on top for a while.

Thanks

Dan Artuso, MVP
 
S

Shadow

Dim xwordobj as object
set xwordobj = CreateObject(word.Application)

the above code creates a reference to Mocrosoft word.
How can I create a reference to Document Imaging ( an application in
office2003)?
( I'm trying to print a .tif file. Van T. Dinh - Dan Aruso - Alex and
Douglas J. Steele showed me how to print .doc and .pdf files through vba in
a previous help request and now I'm trying to print a .tif file)

Any kind of help is much appreciated
 
J

John Nurick

Didn't someone just explain to you how to do the equivalent thing for
PDF files?

Anyway, it would take something along thesse lines:

Dim strFileToPrint As String
Dim strCmd as String

strFileToPrint = "C:\My Folder\My File.tif" 'or whatever

strCmd = """C:\Program Files\Common Files\Microsoft Shared\" _
& "MODI\11.0\MSPVIEW.EXE"" /p """ & strFileToPrint & """"

Shell strCmd
 
S

Shadow

thank you for the details.


John Nurick said:
Didn't someone just explain to you how to do the equivalent thing for
PDF files?

Anyway, it would take something along thesse lines:

Dim strFileToPrint As String
Dim strCmd as String

strFileToPrint = "C:\My Folder\My File.tif" 'or whatever

strCmd = """C:\Program Files\Common Files\Microsoft Shared\" _
& "MODI\11.0\MSPVIEW.EXE"" /p """ & strFileToPrint & """"

Shell strCmd
 
T

Tony Toews

JohnFol said:
PS best to use early binding.

Only while testing and debugging. How do you know what version of
the software, if any, are installed on the client system?

Late binding means you can safely remove the reference and only have
an error when the app executes lines of code in question. Rather than
erroring out while starting up the app and not allowing the users in
the app at all. Or when hitting a mid, left or trim function call.

You'll want to install the reference if you are programming or
debugging and want to use the object intellisense while in the VBA
editor. Then,. once your app is running smoothly, remove the
reference and setup the late binding statements.

Sample code:
' Declare an object variable to hold the object
' reference. Dim as Object causes late binding.
Dim objWordDoc As Object
Set objWordDoc = CreateObject(" Word.Document")

For more information including additional text and some detailed links
see the "Late Binding in Microsoft Access" page at
http://www.granite.ab.ca/access/latebinding.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
S

Shadow

I'm so sorry. It's fixed now



dan artuso said:
Hey Shadow,
Can you please fix your system clock? Your in the future, so that means
you posts will remain on top for a while.

Thanks

Dan Artuso, MVP
 
D

david epsom dot com dot au

MODI; it doesnt' seem to expose an Application object.

But the document object does have a PrintOut method.

(david)
 

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