Hello Everyone!
I have an embedded Word document in a form that I want to open in print preview mode. When I click the button it opens ok but immediately closes when Notes reaches the end of the script. Can anyone offer any ideas? Thanks and happy new year!
Sub Click(Source As Button)
Dim EmbedObj As NotesEmbeddedObject
Dim handle As Variant
Set EmbedObj = doc.EmbeddedObjects(0)
Set handle = uidoc.GetObject(EmbedObj.Name)
Call EmbedObj.Activate(True)
If Left(EmbedObj.class, 13)=“Word.Document” Then
'Sets the font for the footer.
With EmbedObj.Object.Sections(1).Footers(1).Range.Font
.Bold=True
.Size=8
.Italic=True
End With
'Inserts the page number in the footer.
EmbedObj.Object.AttachedTemplate.AutoTextEntries(“Page X of Y”).Insert (EmbedObj.Object.Sections(1).Footers(1).Range)
'Inserts the document name and two tabs in the footer.
EmbedObj.Object.Sections(1).Footers(1).Range.InsertBefore(DocNameString+Chr(9) + Chr(9))
'Switches the Word document to print preview mode
EmbedObj.Object.PrintPreview
End If