Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
tmumaw
Specialist II
Specialist II

Launch Word Document

Does anyone have an example of launching a word document....I'm trying with no luck...

Thanks
Thom

2 Replies
Not applicable

Hi Thom

This macro takes a screen shot of the sheet, launches a word document, pastes the image onto the doc, prints it and dumps it without saving. I assume you can butcher the macro around to make it do what you want.

SUB mcr_PrintActiveSheet
Set objWord = CreateObject("Word.Application")
objWord.Visible = False
Set objDoc = objWord.Documents.Add
Const wdOrientLandscape = 1
objDoc.PageSetup.Orientation = wdOrientLandscape
ActiveDocument.ActiveSheet.CopyBitmapToClipboard false
objWord.Selection.Paste
Const wdAlignParagraphCenter = 1
objDoc.Paragraphs(1).Alignment = wdAlignParagraphCenter
objDoc.PrintOut()
DO WHILE objWord.BackgroundPrintingStatus > 0
LOOP
objWord.Quit wdDoNotSaveChanges
Set objWord = Nothing
Set objDoc = Nothing
END SUB


Regards

Not applicable

I use the code below on a button to simply open a word doc.

sub OpenWordDoc

dim wshShell

set wshShell = CreateObject("Shell.Application")

wshShell.ShellExecute "PathAndFileName","","","open",1

end sub

Stephen