R
ReMeE
In the following code with wich I open a word document from access with
automation it takes about 20 seconds before the file is opened. What can
cause this? I heb tried to disable the viruscontrol but this won't work. I
have added 2 msgbox commands to count the time between 1 and 2 and this is
about 20 seconds.
Sub OpenWordDocument(Documentnaam As String)
On Error GoTo HandleErr
Dim Teller, AantalWoorden, WordApp As Word.Application
On Error Resume Next
Set WordApp = GetObject(, "Word.Application")
If err.Number <> 0 Then
Set WordApp = CreateObject("Word.Application")
End If
WordApp.Visible = True
WordApp.Activate
WordApp.WindowState = wdWindowStateMaximize
Do While WordApp.Documents.Count > 0 'sluit alle open documenten
WordApp.ActiveDocument.Close savechanges:=wdSaveChanges
Loop
If IsFileOpen(Documentnaam) = True Then 'het document is door een andere
gebruiker geopend
MsgBox "Het document is op dit moment door een andere gebruiker
geopend. Probeer het later nog eens.", vbInformation, "Document is in gebruik"
Me.KnopCancel.Enabled = True
Me.KnopOk.Enabled = True
Me.KnopOk.SetFocus
Me.ProgressBar1 = 0
Me.ProgressBar1.Visible = False
Exit Sub
End If
Me.ProgressBar1 = Me.ProgressBar1 + stVoortgang '4
DoEvents
On Error GoTo HandleErr
Msgbox "1"
WordApp.Documents.Open (Documentnaam), , , True
WordApp.ActiveDocument.Save 'As DocumentNaam
Msgbox "2"
automation it takes about 20 seconds before the file is opened. What can
cause this? I heb tried to disable the viruscontrol but this won't work. I
have added 2 msgbox commands to count the time between 1 and 2 and this is
about 20 seconds.
Sub OpenWordDocument(Documentnaam As String)
On Error GoTo HandleErr
Dim Teller, AantalWoorden, WordApp As Word.Application
On Error Resume Next
Set WordApp = GetObject(, "Word.Application")
If err.Number <> 0 Then
Set WordApp = CreateObject("Word.Application")
End If
WordApp.Visible = True
WordApp.Activate
WordApp.WindowState = wdWindowStateMaximize
Do While WordApp.Documents.Count > 0 'sluit alle open documenten
WordApp.ActiveDocument.Close savechanges:=wdSaveChanges
Loop
If IsFileOpen(Documentnaam) = True Then 'het document is door een andere
gebruiker geopend
MsgBox "Het document is op dit moment door een andere gebruiker
geopend. Probeer het later nog eens.", vbInformation, "Document is in gebruik"
Me.KnopCancel.Enabled = True
Me.KnopOk.Enabled = True
Me.KnopOk.SetFocus
Me.ProgressBar1 = 0
Me.ProgressBar1.Visible = False
Exit Sub
End If
Me.ProgressBar1 = Me.ProgressBar1 + stVoortgang '4
DoEvents
On Error GoTo HandleErr
Msgbox "1"
WordApp.Documents.Open (Documentnaam), , , True
WordApp.ActiveDocument.Save 'As DocumentNaam
Msgbox "2"