C
CyndyG
I have created a template with bookmarks. The code runs just fine. THe new
document displays as it should,but after I close it Word continous to run.
The only way I can stop it from running is to go into Task Manager delete the
Word.exe that is still running or bring my system down. Can someone tell me
what I am doing wrong. Here is the code that I have commented out because I
couldn't get it to end Word.exe. At one time I did have close and exit apps
but that didn't work either.
''Private Sub cmdCreateStatementOfWork_Click()
' Const AssociatePickUp As String = "Associates Pick Up"
' Const AssociatePickUp2 As String = "Associate picks up from point"
' Const ArmoredService As String = "Armored Service"
' Const ArmoredService2 As String = "Armored services picks up and notifies
MediaMovement Office(MMO)"
' Const IronMountain As String = "Iron Mountain"
' Const IronMountain2 As String = "Handle pick up and delivery and 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 Aviation As String = "Aviation"
' Const Aviation2 As String = "General aviation"
' Const Corporate As String = "Corporate Aviation"
' Const Corporate2 As String = "Corporate acquired aircraft is in route"
' Const ArmoredServiceDestination As String = "Armored Service Destination"
' Const ArmoredServiceDestination2 As String = "Destination - Use Armored
service to meet aircraft"
' Const AssociateDelivers As String = "Associate Delivers"
' Const AssociateDelivers2 As String = "Associate delivers to destination"
'
'Dim rst As DAO.Recordset
'Dim objDoc As Object
'Dim objDoc2 As Object
'Dim strTab As String
'Dim strLFCR As String
'Dim wd As Word.Application
'Dim myDoc As Word.Document
'Dim str1 As String
'Dim str2 As String
'strTab = Chr$(9)
'strLFCR = Chr$(13)
'
'Set rst = Me.Recordset
'
'
' Set wd = New Word.Application
' wd.Documents.Add ("C:\Test\StatementofWork.dot")
'' wd.Documents.Add ("C:\Test\StatementofWork.dot")
' Set myDoc = wd.ActiveDocument
' With wd.Selection
' .GoTo wdGoToBookmark, Name:="strCaseID"
' .TypeText Text:=Nz(rst.Fields("strCaseID"))
' .GoTo wdGoToBookmark, Name:="strRequestorName"
' .TypeText Text:=Nz(rst.Fields("strRequestorName"))
' .GoTo wdGoToBookmark, Name:="strRequestorPhone"
' .TypeText Text:=Nz(rst.Fields("strRequestorPhone"))
' .GoTo wdGoToBookmark, Name:="lngPiecesMoved"
' .TypeText Text:=Nz(rst.Fields("lngPiecesMoved"))
' .GoTo wdGoToBookmark, Name:="lngUnitsMoved"
' .TypeText Text:=Nz(rst.Fields("lngUnitsMoved"))
' .GoTo wdGoToBookmark, Name:="strEncrypted"
' .TypeText Text:=Nz(rst.Fields("strEncrypted"))
' .GoTo wdGoToBookmark, Name:="strDERS"
' .TypeText Text:=Nz(rst.Fields("strDERS"))
' .GoTo wdGoToBookmark, Name:="ysnISER"
' .TypeText Text:=Nz(rst.Fields("ysnISER"))
' .GoTo wdGoToBookmark, Name:="strLeavingCity"
' .TypeText Text:=Nz(rst.Fields("strLeavingCity"))
' .GoTo wdGoToBookmark, Name:="strArrivingCity"
' .TypeText Text:=Nz(rst.Fields("strArrivingCity"))
'If Me.ysnAssociatePickUp = True Then
' str1 = AssociatePickUp & 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.ysnAviation = True Then
' str1 = str1 & Aviation & strTab & Aviation2 & 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.ysnAssociateDelivers = True Then
' str2 = AssociateDelivers & strTab & AssociateDelivers2 & strLFCR
' End If
'objDoc.Bookmarks("VariableText2").Range.Text = str2
' objDoc.Parent.Visible = True
' objDoc.Parent.Activate
'Set objDoc = Nothing
'End With
'wd.Visible = True
'End Sub
document displays as it should,but after I close it Word continous to run.
The only way I can stop it from running is to go into Task Manager delete the
Word.exe that is still running or bring my system down. Can someone tell me
what I am doing wrong. Here is the code that I have commented out because I
couldn't get it to end Word.exe. At one time I did have close and exit apps
but that didn't work either.
''Private Sub cmdCreateStatementOfWork_Click()
' Const AssociatePickUp As String = "Associates Pick Up"
' Const AssociatePickUp2 As String = "Associate picks up from point"
' Const ArmoredService As String = "Armored Service"
' Const ArmoredService2 As String = "Armored services picks up and notifies
MediaMovement Office(MMO)"
' Const IronMountain As String = "Iron Mountain"
' Const IronMountain2 As String = "Handle pick up and delivery and 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 Aviation As String = "Aviation"
' Const Aviation2 As String = "General aviation"
' Const Corporate As String = "Corporate Aviation"
' Const Corporate2 As String = "Corporate acquired aircraft is in route"
' Const ArmoredServiceDestination As String = "Armored Service Destination"
' Const ArmoredServiceDestination2 As String = "Destination - Use Armored
service to meet aircraft"
' Const AssociateDelivers As String = "Associate Delivers"
' Const AssociateDelivers2 As String = "Associate delivers to destination"
'
'Dim rst As DAO.Recordset
'Dim objDoc As Object
'Dim objDoc2 As Object
'Dim strTab As String
'Dim strLFCR As String
'Dim wd As Word.Application
'Dim myDoc As Word.Document
'Dim str1 As String
'Dim str2 As String
'strTab = Chr$(9)
'strLFCR = Chr$(13)
'
'Set rst = Me.Recordset
'
'
' Set wd = New Word.Application
' wd.Documents.Add ("C:\Test\StatementofWork.dot")
'' wd.Documents.Add ("C:\Test\StatementofWork.dot")
' Set myDoc = wd.ActiveDocument
' With wd.Selection
' .GoTo wdGoToBookmark, Name:="strCaseID"
' .TypeText Text:=Nz(rst.Fields("strCaseID"))
' .GoTo wdGoToBookmark, Name:="strRequestorName"
' .TypeText Text:=Nz(rst.Fields("strRequestorName"))
' .GoTo wdGoToBookmark, Name:="strRequestorPhone"
' .TypeText Text:=Nz(rst.Fields("strRequestorPhone"))
' .GoTo wdGoToBookmark, Name:="lngPiecesMoved"
' .TypeText Text:=Nz(rst.Fields("lngPiecesMoved"))
' .GoTo wdGoToBookmark, Name:="lngUnitsMoved"
' .TypeText Text:=Nz(rst.Fields("lngUnitsMoved"))
' .GoTo wdGoToBookmark, Name:="strEncrypted"
' .TypeText Text:=Nz(rst.Fields("strEncrypted"))
' .GoTo wdGoToBookmark, Name:="strDERS"
' .TypeText Text:=Nz(rst.Fields("strDERS"))
' .GoTo wdGoToBookmark, Name:="ysnISER"
' .TypeText Text:=Nz(rst.Fields("ysnISER"))
' .GoTo wdGoToBookmark, Name:="strLeavingCity"
' .TypeText Text:=Nz(rst.Fields("strLeavingCity"))
' .GoTo wdGoToBookmark, Name:="strArrivingCity"
' .TypeText Text:=Nz(rst.Fields("strArrivingCity"))
'If Me.ysnAssociatePickUp = True Then
' str1 = AssociatePickUp & 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.ysnAviation = True Then
' str1 = str1 & Aviation & strTab & Aviation2 & 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.ysnAssociateDelivers = True Then
' str2 = AssociateDelivers & strTab & AssociateDelivers2 & strLFCR
' End If
'objDoc.Bookmarks("VariableText2").Range.Text = str2
' objDoc.Parent.Visible = True
' objDoc.Parent.Activate
'Set objDoc = Nothing
'End With
'wd.Visible = True
'End Sub