Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello,
I need to open a .tif file and print it out, then close the file using VBScript. I am new at scripting and I do not have a book and I cannot find this anywhere on the web.
Thanks!

As far as opening the file you could use the ShellExecute function. The ShellExecute function will have to be declared as follows
Declare Function ShellExecute 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 LongThen you can call the ShellExecute function in your macro by doing something like this
dim someVariable
someVariable = ShellExecute(0&, vbNullString, Environ("USERPROFILE") + "\My Documents\myTiffFile.tif", vbNullString, vbNullString, vbNormalFocus)
More info on ShellExecute can be found here
http://msdn.microsoft.com/library/d...

Thanks, I used
set shell = createobject("WScript.shell")
shell.Run ("mspaint /pt "filepath" "printer name")

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |