C
CyndyG
I am trying to get information from my Access form to a Word document that is
bookmarked. I am receiving the following error:214741851(80010105). I have
also read and went to some of the links that show some of the examples of
doing this,but none of them work for me. This may be a Microsoft Professional
Support question,but I hope someone here can help me. Here is the code.
rivate Sub cmdCallTemplate_Click()
Const AssociateHandOff As String = "Associates Hand-Off"
Const AssociateHandOff2 As String = "Associate picks up from point"
Const ArmoredService As String = "Armored Service"
Const ArmoredService2 As String = "Armored services notifies MediaMovement
Office(MMO)package is in their possession"
Const IronMountain As String = "Iron Mountain"
Const IronMountain2 As String = "will provide statement of work"
Const AssociateHandles As String = "Associate Handles All Travel"
Const AssociateHandles2 As String = "Travels with media from point of origin"
Const Corporate As String = "Corporate Aviation"
Const Corporate2 As String = "Corporate acquired aircraft is in route"
Const ArmoredServiceDestination As String = "Armored Service"
Const ArmoredServiceDestination2 As String = "Destination - Use Armored
service to meet aircraft"
Const Destinations As String = "Destinations"
Const Destinations2 As String = "Use Armored service to meet aircraft"
Dim rst As DAO.Recordset
Dim objDoc As Object
Dim objDoc2 As Object
Dim strTab As String
Dim strLFCR As String
Dim str1 As String
Dim str2 As String
strTab = Chr$(9)
strLFCR = Chr$(13)
Set rst = Me.Recordset
Set objDoc = GetObject("C:\StatementofWork.dot")
objDoc.SaveAs ("C:\StatementofWork.doc")
objDoc.Close
Set objDoc = GetObject("C:\StatementofWork.doc")
objDoc.Bookmarks("strCaseID").Range.Text = Nz(rst.Fields("strCaseID"))
objDoc.Bookmarks("strRequestorName").Range.Text =
Nz(rst.Fields("strRequestorName"))
objDoc.Bookmarks("strRequestorPhone").Range.Text =
Nz(rst.Fields("strRequestorPhone"))
objDoc.Bookmarks("lngPiecesMoved").Range.Text =
Nz(rst.Fields("lngPiecesMoved"))
objDoc.Bookmarks("lngUnitsMoved").Range.Text = Nz(rst.Fields("lngUnitsMoved"))
objDoc.Bookmarks("strEncrypted").Range.Text = Nz(rst.Fields("strEncrypted"))
objDoc.Bookmarks("ysnDERS").Range.Text = Nz(rst.Fields("ysnDERS"))
objDoc.Bookmarks("ysnISER").Range.Text = Nz(rst.Fields("ysnISER"))
objDoc.Bookmarks("strLeavingCity").Range.Text =
Nz(rst.Fields("strLeavingCity"))
objDoc.Bookmarks("strArrivingCity").Range.Text =
Nz(rst.Fields("strArrivingCity"))
'If Me.ysnAssociateHand_Off = True Then
' str1 = AssociateHandOff & strTab & AssociateHandOff2 & strLFCR
' End If
'If Me.ysnArmoredService = True Then
' str1 = str1 & ArmoredService & strTab & ArmoredService2 & strLFCR
' End If
' If Me.ysnironMountain = True Then
' str1 = str1 & IronMountain & strTab & IronMountain2 & strLFCR
' End If
' If Me.ysnAssociateHandles = True Then
' str1 = str1 & AssociateHandles & strTab & AssociateHandles2 & strLFCR
' End If
'If Me.ysnCorporate = True Then
' str1 = str1 & Corporate & strTab & Corporate2 & strLFCR
' End If
' If Me.ysnArmoredServiceDestination = True Then
' str1 = str1 & ArmoredServiceDestination & strTab &
ArmoredServiceDestination2 & strLFCR
' 'End If
' objDoc.Bookmarks("VariableText1").Range.Text = str1
'If Me.ysnDestinations = True Then
' str2 = Destinations & strTab & Destinations2 & strLFCR
' End If
'objDoc.Bookmarks("VariableText2").Range.Text = str2
' objDoc.Parent.Visible = True
' objDoc.Parent.Activate
Set objDoc = Nothing
End Sub
I have some things commented out because I was trying to get the bookmark
section to run.
bookmarked. I am receiving the following error:214741851(80010105). I have
also read and went to some of the links that show some of the examples of
doing this,but none of them work for me. This may be a Microsoft Professional
Support question,but I hope someone here can help me. Here is the code.
rivate Sub cmdCallTemplate_Click()
Const AssociateHandOff As String = "Associates Hand-Off"
Const AssociateHandOff2 As String = "Associate picks up from point"
Const ArmoredService As String = "Armored Service"
Const ArmoredService2 As String = "Armored services notifies MediaMovement
Office(MMO)package is in their possession"
Const IronMountain As String = "Iron Mountain"
Const IronMountain2 As String = "will provide statement of work"
Const AssociateHandles As String = "Associate Handles All Travel"
Const AssociateHandles2 As String = "Travels with media from point of origin"
Const Corporate As String = "Corporate Aviation"
Const Corporate2 As String = "Corporate acquired aircraft is in route"
Const ArmoredServiceDestination As String = "Armored Service"
Const ArmoredServiceDestination2 As String = "Destination - Use Armored
service to meet aircraft"
Const Destinations As String = "Destinations"
Const Destinations2 As String = "Use Armored service to meet aircraft"
Dim rst As DAO.Recordset
Dim objDoc As Object
Dim objDoc2 As Object
Dim strTab As String
Dim strLFCR As String
Dim str1 As String
Dim str2 As String
strTab = Chr$(9)
strLFCR = Chr$(13)
Set rst = Me.Recordset
Set objDoc = GetObject("C:\StatementofWork.dot")
objDoc.SaveAs ("C:\StatementofWork.doc")
objDoc.Close
Set objDoc = GetObject("C:\StatementofWork.doc")
objDoc.Bookmarks("strCaseID").Range.Text = Nz(rst.Fields("strCaseID"))
objDoc.Bookmarks("strRequestorName").Range.Text =
Nz(rst.Fields("strRequestorName"))
objDoc.Bookmarks("strRequestorPhone").Range.Text =
Nz(rst.Fields("strRequestorPhone"))
objDoc.Bookmarks("lngPiecesMoved").Range.Text =
Nz(rst.Fields("lngPiecesMoved"))
objDoc.Bookmarks("lngUnitsMoved").Range.Text = Nz(rst.Fields("lngUnitsMoved"))
objDoc.Bookmarks("strEncrypted").Range.Text = Nz(rst.Fields("strEncrypted"))
objDoc.Bookmarks("ysnDERS").Range.Text = Nz(rst.Fields("ysnDERS"))
objDoc.Bookmarks("ysnISER").Range.Text = Nz(rst.Fields("ysnISER"))
objDoc.Bookmarks("strLeavingCity").Range.Text =
Nz(rst.Fields("strLeavingCity"))
objDoc.Bookmarks("strArrivingCity").Range.Text =
Nz(rst.Fields("strArrivingCity"))
'If Me.ysnAssociateHand_Off = True Then
' str1 = AssociateHandOff & strTab & AssociateHandOff2 & strLFCR
' End If
'If Me.ysnArmoredService = True Then
' str1 = str1 & ArmoredService & strTab & ArmoredService2 & strLFCR
' End If
' If Me.ysnironMountain = True Then
' str1 = str1 & IronMountain & strTab & IronMountain2 & strLFCR
' End If
' If Me.ysnAssociateHandles = True Then
' str1 = str1 & AssociateHandles & strTab & AssociateHandles2 & strLFCR
' End If
'If Me.ysnCorporate = True Then
' str1 = str1 & Corporate & strTab & Corporate2 & strLFCR
' End If
' If Me.ysnArmoredServiceDestination = True Then
' str1 = str1 & ArmoredServiceDestination & strTab &
ArmoredServiceDestination2 & strLFCR
' 'End If
' objDoc.Bookmarks("VariableText1").Range.Text = str1
'If Me.ysnDestinations = True Then
' str2 = Destinations & strTab & Destinations2 & strLFCR
' End If
'objDoc.Bookmarks("VariableText2").Range.Text = str2
' objDoc.Parent.Visible = True
' objDoc.Parent.Activate
Set objDoc = Nothing
End Sub
I have some things commented out because I was trying to get the bookmark
section to run.