Jason Sas 19.May.08 08:15 PM a Web browser Domino Designer6.5.6; 6.5.5 FP3; 6.5.5 FP2; 6.5.5 FP1; 6.5.5; 6.5.4 FP3; 6.5.4 FP2; 6.5.4 FP1; 6.5.4; 6.5.3 FP2; 6.5.3 FP1; 6.5.3; 6.5.2 FP1; 6.5.2; 6.5.1; 6.5Windows XP
Hi,
I'm trying to modify a piece of code and word template that was previously created. Basically the code accesses a Word template saved to a field on a document and then replaces certain values such as title, person assigned etc. I'd like to move some of the values in the Word document to the Header/Footer, but as soon as I do this the code doesn't replace the values (ie, it looks like it can't see those variables on the Word document). Is there anyway to move these values to the Header/Footer on the Word document and still let Notes be able to see them? See my sample code below:
Function EditBriefDocument(COAGDocument As NotesDocument) As NotesDocument
'CreatebriefDocument
'Parameters
'PPQDocument : The Document that the brief is being created for.
'Description
'This function will create/edit a brief document for the specified PPQ document.
Dim BriefTemplate As Variant
Dim OutputPath As String
Dim LeadBranch As String
Dim Branchheads As Variant
Dim PolicyOfficerNo As String
Dim BranchManagerNo As String
Dim Session As New NotesSession
Dim BriefDocument As NotesDocument
Dim BriefEmbeddedField As NotesRichTextItem
Dim WorkSpace As New NotesUiWorkSpace
Dim AuthorsList As NotesItem
Dim ReadersList As NotesItem
If BriefExists(COAGDocument, BriefDocument) Then
If Not BriefDocument Is Nothing Then
Set EditBriefDocument = BriefDocument
Exit Function
End If
End If
'// Get the Branch managers phone number and insert it into the document
'// Insert common name of the Branch manager into the document
LeadBranch = GetLeadBranch(COAGDocument)
BranchHeads = GetBranchField(LeadBranch, "BranchHeads")
BranchManagerNo = GetNADocField(GetCanonicalName(Cstr(BranchHeads(0)) ), "OfficePhoneNumber")(0)
'// Get the the Policy officer's phone number and insert it into the document
PolicyOfficerNo = GetNADocField(GetCanonicalName(COAGDocument.PolicyOfficer(0)), "OfficePhoneNumber")(0)
'// Get the index template document
Set BriefTemplate = GetTemplateDocument ("COAGTemplate", OutputPath)
'// Insert the topic of the PPQDocument into the brief document
' BriefTemplate.EditReplace "%TOPIC%", Ucase(Cstr(COAGDocument.Topic(0))), 0, 0, 1, 0, 0, 0, 0, 1, 0, 0
'// Insert the subject of the PPQDocument into the brief document
' BriefTemplate.EditReplace "%SUBJECT%", Ucase(Cstr(COAGDocument.Subject(0))), 0, 0, 1, 0, 0, 0, 0, 1, 0, 0
'// Insert the common name of the Policy officer into the brief
BriefTemplate.EditReplace "%POLICYOFFICER%", CommonName(Cstr(COAGDocument.LeadBriefingOfficer(0))), 0, 0, 1, 0, 0, 0, 0, 1, 0, 0
'// Get the create date of the brief, format it into dd month yyyy and insert it into the document
BriefTemplate.EditReplace "%Date%", Format(Date$ , "dd/mm/yy"), 0, 0, 1, 0, 0, 0, 0, 1, 0, 0
'// Turn off set summary info
BriefTemplate.ToolsOptionsSave 0, 0, 0
'// Create the notes index document in the database
Set BriefDocument = New NotesDocument(Session.CurrentDatabase)
BriefDocument.Form = "COAG Document"
Set ReadersList = New NotesItem(BriefDocument, "ReadersList", COAGDocument.ReadersList,Readers)
Set AuthorsList = New NotesItem(BriefDocument,"AuthorsList", COAGDocument.PolicyOfficer,Authors)
BriefDocument.ReadersList = COAGDocument.ReadersList
BriefDocument.AuthorsList = COAGDocument.AuthorsList
BriefDocument.ParentDocUniqueId = COAGDocument.DocumentID
BriefDocument.EditMode = "Read"
BriefDocument.VersionNumber = 0
Set BriefEmbeddedField = New NotesRichtextItem(BriefDocument,"BriefDocument")
Call BriefEmbeddedField.EmbedObject (EMBED_OBJECT, "", OutputPath, "Brief.doc")
Call BriefDocument.makeResponse(COAGDocument)
Call BriefDocument.Save(False,False)
If Not BriefDocument Is Nothing Then
Set EditBriefDocument = BriefDocument
Else
Set EditBriefDocument = Nothing
End If