Home
TeamSite
Word/FileSite Integration
System
I'm using Word 2003 integrated with FileSite and a VB Custom application. For testing purposes, I have an instance of Word already open. When running my custom application, I check to see if Word is already open, if it is, I try to open up another Word document in that same instance of Word, do what I need to do, then attempt to close the document from code in the Custom application using this line: aWordDoc.close savechanges:=wdDoNotSaveChanges
My program ends up "hanging" because I receive a message in Word asking if I want to save changes to the document I just opened. I was not receiving this error message on our previous setup which did not include FileSite or Word 2003. Has anyone else experienced this? Is there some extra code I need to write because of the Word/FileSite integration?
Find more posts tagged with
Comments
Weiqun
The dialog prompted to ask you if you want to save the changes is from the office integration. Here is a way to turn off this prompt through a word macro.
Here is how you could avoid this:
1. create a macro named as ****.dot, and add a module to it.
2. Copy the following code to this module:
Private objSinkObject As New SinkObject
Public Sub AutoExec()
Dim objIManageExtensibility As iManO2K.iManageExtensibility
' An object used for extending the functionality of iManage Office 2000 integration.
' Get the iManage O2K extensibility object.
Set objIManageExtensibility = Word.Application.COMAddIns.Item("iManO2K.AddinForWord2000").Object
' Set up a sink to the extensibility object.
objSinkObject.SinkIManageExtensibility objIManageExtensibility
End Sub
3. Now add a class module to this macro file ****.dot. And then copy the following code to it.
Private WithEvents objExtensibilitySink As iManO2K.iManageExtensibility
Public Sub SinkIManageExtensibility(ByVal objExtensibility As iManO2K.iManageExtensibility)
Set objExtensibilitySink = objExtensibility
End Sub
Private Sub objExtensibilitySink_FireDocumentBeforeClose2(ByVal Doc As Object, IgnoreIManageSave As Boolean, Cancel As Boolean)
'Doc is a Word Document. 'By default IgnoreIManageSave is False. And the save will by handled by the iManO2K.dll.
'To override the default behavior, you could set the "IgnoreIManageSave" to true,
IgnoreIManageSave = True
End Sub
These code should be able to solve your issue.
Good Luck,
Weiqun
Migrateduser
Believe it or not, I was able to call this simple command: Aworddoc.save
This saves the current Word document that is open, so when I tell Word to close, there are no currently un-saved Word documents and Word behaves correctly.
guido1
Although you've already found yourself a solution, forcing a Save seems a bit harsh, especially if it is a large document.
However, as you discovered, the wdDoNotSaveChanges parameter for the Close method in Word isn't reliable in certain situations. To be sure, set the Saved property of the document to True before you try to close it. That never fails.