Save WORD DOC in TIFF format using VB6 Script to

L

Lennie Kuah

Hi Guru,
I am trying to save WORD 2003 document in TIFF format using Vb6 script. How
to do it?

Here is my Vb script
Reference Lib:Microsoft Office Document Imaging 11.0 library
Dim oWord As Word.Application
Dim oDoc As Word.Document
Dim oTiffDoc As MODI.Document

Dim newTiff As String

Set oWord = New Word.Application
Set oDoc = oWord.Documents.Open("H:\Junk\TestTiff.doc", ,
ReadOnly:=True)
Set oTiffDoc = New MODI.Document
newTiff = " E:\Westpac\TestWORD2TIFF\Myfile.tif"
oTiffDoc.SaveAs oTiffDoc, miFILE_FORMAT_TIFF




Please Help me. Thanks.

Cheers,
Lennie
 
J

Jean-Guy Marcil

Lennie Kuah said:
Hi Guru,
I am trying to save WORD 2003 document in TIFF format using Vb6 script. How
to do it?

Here is my Vb script
Reference Lib:Microsoft Office Document Imaging 11.0 library
Dim oWord As Word.Application
Dim oDoc As Word.Document
Dim oTiffDoc As MODI.Document

Dim newTiff As String

Set oWord = New Word.Application
Set oDoc = oWord.Documents.Open("H:\Junk\TestTiff.doc", ,
ReadOnly:=True)
Set oTiffDoc = New MODI.Document
newTiff = " E:\Westpac\TestWORD2TIFF\Myfile.tif"
oTiffDoc.SaveAs oTiffDoc, miFILE_FORMAT_TIFF

Word automatically creates a TIFF file from the "Microsoft Office Document
Image Writer" printer.
So, all you need to do is use that printer...


Dim strActivePrinter As String
Dim strTifPath As String
Dim strTifFolder As String
Dim strTifFile As String

'Save current printer
strActivePrinter = Application.ActivePrinter
strTifFolder = "C:\My Documents\"
strTifFile = "TestTiff.tif"

'Use dialog so we do not change the system wide default printer
With Dialogs(wdDialogFilePrintSetup)
.Printer = "Microsoft Office Document Image Writer"
.DoNotSetAsSysDefault = True
.Execute
End With

'Set tif file path and name
strTifPath = strTifFolder & strTifFile

'Create tif file
Application.PrintOut Background:=False, Append:=False, _
Range:=wdPrintAllDocument, OutputFileName:=strTifPath, _
Item:=wdPrintDocumentContent, Copies:=1, _
PageType:=wdPrintAllPages, PrintToFile:=True

'Reset printer
With Dialogs(wdDialogFilePrintSetup)
.Printer = strActivePrinter
.DoNotSetAsSysDefault = True
.Execute
End With
 

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