Below is my code. The error is "Compile Error Variable not defined". wdOrientLandsca pe is highlighted. Again this the portion of the code from a VB module created in Excel. The previous lines of code are passing cell contents from a worksheet and then into the variable that are shown in the respective lines for each occurance of .TypeText:=
By the way the next i is a counter to ensure all the rows in the active worksheet are passed to to the variables and thereby printed.
By the way the next i is a counter to ensure all the rows in the active worksheet are passed to to the variables and thereby printed.
Code:
' Send commands to Word
With WordApp
.Documents.Add
.PageSetup.Orientation = wdOrientLandscape
With .Selection
.Font.Size = 14
.Font.Bold = True
.ParagraphFormat.Alignment = 1
.TypeText Text:="E C R"
.TypeParagraph
.TypeParagraph
.Font.Size = 12
.ParagraphFormat.Alignment = 0
.Font.Bold = False
.TypeText Text:="Date Created:" & vbTab & DateCreated & vbTab
.TypeText Text:="Initiated By:" & vbTab & _
Application.UserName
.TypeParagraph
.TypeText Text:="Serial Number:" & vbTab & SerialNumber
' .TypeText message
.TypeText Text:="Tool Name:" & vbTab & ToolName
.TypeText Text:="Drawing Number:" & vbTab & DrawingNumber
.TypeText Text:="Drawing Title:" & vbTab & DrawingTitle
.TypeText Text:="Revision:" & vbTab & Rev
.TypeText Text:="Change Request:" & vbTab & ChangeRequest
.TypeText Text:="Change Reason:" & vbTab & ChangeReason
.TypeText Text:="Additional Information:" & vbTab & AddlInfo
End With
.ActiveDocument.SaveAs Filename:=SaveAsName
End With
Next i
' Kill the object
WordApp.Quit
Set WordApp = Nothing
Comment