First, let me explain the symptoms. We only use Microsoft servers. When we tries to save large (1 Mb and more) reports on a network share Desktop Intelligence crashs with an c0000005 exception. This only happened with the “save as” option. If the document is already saved in the directory, there’s no problem accessing and saving it. The problem is that the file dialog change the current directory to the destination directory. Then, DI tries to write temporary files on the root of the current directory but the user doesn’t have write privilege on the root of the network share and DI crashs.
Our fix is quite simple. Build a macro that trap the “beforesave” event and change back the current directory to a directory where the user have write privilege (in our case the root C:). The beforesave event is -luckily- triggered after the file dialog and before the save. So now, with the actual macro …
in the “ThisDocument”
Dim X As New EventClassModule
Sub Document_Open()
Set X.App = Application
End Sub
in a module
Public Declare Function SetCurDir Lib “kernel32” _
Alias “SetCurrentDirectoryA” _
(ByVal lpPathName As String) As Long
in a class module named EventClassModule
Public WithEvents App As Application
Private Sub App_DocumentBeforeSave(ByVal Doc As IDocument, Cancel As Boolean)
Dim lRetSetCurDir As Long
lRetSetCurDir = SetCurDir(“C:”)
End Sub
Is really that simple. The macro is included in this post as “Eventbeforesave.rea”. It should traps all the “beforesave” events of all the documents.
Enjoy !
Guillaume Auger
Régie des Rentes du Québec
guillaume.auger(at@)rrq.gouv.qc.ca
Eventbeforesave.rea (50.0 KB)
GuillaumeA (BOB member since 2006-11-15)