bradmaunsell
Programmer
This is about a problem with WORD docs being created from ACCESS and saved to the server.
Windows XP SP2 on all workstations
Server has Windows 2003
We have an Access application that creates Word documents, saves them on the server and writes hyperlinks to associate these Word docs with an insurance bound policy record.
This all work great when everything is running on my (development) laptop.
However, when running in our production directory on the server, some Word docs are created correctly and saved properly but we are finding some other Word docs named "Backup of NNNNN_FFFFFFFFFFF_YYYMMDD.WBK" are also being created.
I use this same code in another application for quoting and it has been running fine on the server for over a year.
I have no clues to why these WBK docs are being created.
The general flow is as follows:
On a datasheet styl form, there is a button "Create Word Doc"
Set variable to Word Template name
Create New Word Instance
Open the template and Polulate Word Doc
Use Select Case to call actaul document's Visual Basic to go to various Bookmarks in template (Uses this command: oWord.Documents.Add pathWordtemplates & "\" & strWordTemplateName, NewTemplate:=False, DocumentType:=0 )
Save the Word Docs on the server
Public Sub SaveWordDoc(strSaveAs As String, lngAppID As Long)
Dim strDate As String
Dim SaveDocPathAndName As String
If Left(strTemplateName, 5) <> "QUOTE" Then
strDate = Format(Now(), "yyyymmdd")
Else
strDate = Format(Now(), "yyyymmdd_HHMM")
End If
SaveDocPathAndName = strSaveAs & "_" & strDate
SaveDocPathAndName = pathSaveWordDocs & "\" & SaveDocPathAndName
oWord.ChangeFileOpenDirectory pathSaveWordDocs
oWord.ActiveDocument.SaveAs FileName:=SaveDocPathAndName, FileFormat:=wdFormatDocument, LockComments:=False, _
Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, _
EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
AppendDocumentHyperlink SaveDocPathAndName, lngAppID
End Sub
Close everthing up with this routine
If WordOpen = True Then
oWord.Application.Quit
Set oWord = Nothing
WordOpen = False
Err = 0
End If
As I mentioned before, this works great when run locally and the WBK file creations do not always occur.
Anybody have any ideas?
Thanks,
Brad
Windows XP SP2 on all workstations
Server has Windows 2003
We have an Access application that creates Word documents, saves them on the server and writes hyperlinks to associate these Word docs with an insurance bound policy record.
This all work great when everything is running on my (development) laptop.
However, when running in our production directory on the server, some Word docs are created correctly and saved properly but we are finding some other Word docs named "Backup of NNNNN_FFFFFFFFFFF_YYYMMDD.WBK" are also being created.
I use this same code in another application for quoting and it has been running fine on the server for over a year.
I have no clues to why these WBK docs are being created.
The general flow is as follows:
On a datasheet styl form, there is a button "Create Word Doc"
Set variable to Word Template name
Create New Word Instance
Open the template and Polulate Word Doc
Use Select Case to call actaul document's Visual Basic to go to various Bookmarks in template (Uses this command: oWord.Documents.Add pathWordtemplates & "\" & strWordTemplateName, NewTemplate:=False, DocumentType:=0 )
Save the Word Docs on the server
Public Sub SaveWordDoc(strSaveAs As String, lngAppID As Long)
Dim strDate As String
Dim SaveDocPathAndName As String
If Left(strTemplateName, 5) <> "QUOTE" Then
strDate = Format(Now(), "yyyymmdd")
Else
strDate = Format(Now(), "yyyymmdd_HHMM")
End If
SaveDocPathAndName = strSaveAs & "_" & strDate
SaveDocPathAndName = pathSaveWordDocs & "\" & SaveDocPathAndName
oWord.ChangeFileOpenDirectory pathSaveWordDocs
oWord.ActiveDocument.SaveAs FileName:=SaveDocPathAndName, FileFormat:=wdFormatDocument, LockComments:=False, _
Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, _
EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
AppendDocumentHyperlink SaveDocPathAndName, lngAppID
End Sub
Close everthing up with this routine
If WordOpen = True Then
oWord.Application.Quit
Set oWord = Nothing
WordOpen = False
Err = 0
End If
As I mentioned before, this works great when run locally and the WBK file creations do not always occur.
Anybody have any ideas?
Thanks,
Brad