Hi All
I am sorry that this might be a simple question but unfortunately I am in hospital away from my usual environment of reference books, files and seemingly at the moment – Brains!
I have a complex Excel workbook (Medications Control.xlsm) that controls a number of internal and external Excel worksheets and workbooks. It also calls up Word documents that are controlled by Word Macros and these are generally printing instructions.
An example of this is that I have a macro "PrintWordDoc" in Excel which opens an existing Word document and then gives it instructions to operate a macro which in turn controls the printing.
A simple Excel Macro that selects a Word File and then operates the Word Macro "PrintCarryDoc"
What I wish to do is get a variable for the number of copies needed, from Excel, and put that figure into the Word macro changing Copies:= 1 to that required. Possibly in the form PrintWordDoc 4 (from Excel) and PrintCarryDoc (X as integer) to be received by Word thereby generating 4 copies.
I am sorry but, at the moment, my brain will not allow me to work it out
I am sorry that this might be a simple question but unfortunately I am in hospital away from my usual environment of reference books, files and seemingly at the moment – Brains!
I have a complex Excel workbook (Medications Control.xlsm) that controls a number of internal and external Excel worksheets and workbooks. It also calls up Word documents that are controlled by Word Macros and these are generally printing instructions.
An example of this is that I have a macro "PrintWordDoc" in Excel which opens an existing Word document and then gives it instructions to operate a macro which in turn controls the printing.
Code:
Sub PrintWordDoc()
Dim oWord As Word.Application
Dim oDoc As Word.Document
Set oWord = CreateObject("Word.Application")
Set oDoc = oWord.Documents.Open("D:\Paul's Files\Carry List.docm")
oWord.Visible = True
oWord.Run MacroName:="PrintCarryDoc"
oWord.ActiveDocument.Save
oWord.Quit
Set oWord = Nothing
End Sub
A simple Excel Macro that selects a Word File and then operates the Word Macro "PrintCarryDoc"
Code:
Sub PrintCarryDoc()
With ActiveDocument.PageSetup
.LineNumbering.Active = False
'General Printing Control
.BookFoldPrinting = False
.BookFoldRevPrinting = False
.BookFoldPrintingSheets = 1
.GutterPos = wdGutterPosLeft
End With
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentWithMarkup, [b]Copies:=1[/b], Pages:="", PageType:= _
wdPrintAllPages, Collate:=True, Background:=True, PrintToFile:=False, _
PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
WriteData_PagesPrinted
End Sub
I am sorry but, at the moment, my brain will not allow me to work it out