Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Does anyone have an example of launching a word document....I'm trying with no luck...
Thanks
Thom
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
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