Sub AutoNew
ProcurementDocType.Show
'RUN TIME ERROR 76 ON LINE BELOW
If ActiveDocument.CustomDocumentProperties.Item("xDocType") = "Request for Tender" Then GEOProcurementMenu.txtDocNo = "RFT"
If ActiveDocument.CustomDocumentProperties.Item("xDocType") = "Request for Quote" Then GEOProcurementMenu.txtDocNo = "RFQ"
If ActiveDocument.CustomDocumentProperties.Item("xDocType") = "Request for Proposal" Then GEOProcurementMenu.txtDocNo = "RFP"
GEOProcurementMenu.txtRevisionDate = Format$(Date, "dd/mm/yyyy")
GEOProcurementMenu.Show
End Sub
Private Sub ClickAction()
If Me.OptTender = False And _
Me.OptQuote = False And _
Me.OptProposal = False Then
MsgBox "Please select the Document Type.", , "SELECTION REQUIRED"
Exit Sub
End If
'Load fields
If Me.OptTender = True Then
ActiveDocument.CustomDocumentProperties.Item("xDocType").Value = "Request for Tender"
ElseIf Me.OptQuote = True Then
ActiveDocument.CustomDocumentProperties.Item("xDocType").Value = "Request for Quote"
ElseIf Me.OptProposal = True Then
ActiveDocument.CustomDocumentProperties.Item("xDocType").Value = "Request for Proposal"
End If
Call InsertDoc
Unload Me
End Sub
Private Sub InsertDoc()
Path = ActiveDocument.AttachedTemplate.Path
Selection.GoTo What:=wdGoToBookmark, Name:="StartHere"
n = Selection.Information(wdActiveEndSectionNumber)
Call UnprotectMyDoc
If ActiveDocument.CustomDocumentProperties.Item("xDocType").Value = "Request for Tender" Then
Selection.InsertFile Path & "\Support File Proc_Tender.docx"
ElseIf ActiveDocument.CustomDocumentProperties.Item("xDocType").Value = "Request for Quote" Then
Selection.InsertFile Path & "\Support File Proc_Quote.docx"
ElseIf ActiveDocument.CustomDocumentProperties.Item("xDocType").Value = "Request for Proposal" Then
Selection.InsertFile Path & "\Support File Proc_Proposal.docx"
Else
MsgBox "Unable to find support file. Please contact your administrator", , "Error"
End If
Call ProtectMyDoc
ActiveDocument.Sections(n).Headers(wdHeaderFooterPrimary).LinkToPrevious = True
ActiveDocument.Sections(n).Footers(wdHeaderFooterPrimary).LinkToPrevious = True
End Sub
|