Jeg er kommet til at tænke på, om der kan være en sammenhæng med, om man har sat Word til automatisk at gemme hvert X'te minut - Funktioner > Indstillinger > fanebladet gem > Gem oplysninger til automatisk gendannelse hvert x'te minut. Altså kan det være på det tidspunkt, hvor Word starter med at gemme automatisk?
Hvis ja, kan man så tilføje eller ændre et script i VB'et sådan at fejlen ikke opstår, selv om Word går i gang med at gemme?
Billede af vindue med fejlbesked:
http://www.elseif.dk/word/word_fejl_01.jpgVB kode:
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Sub Rediger()
' Aktiveres via Alt + R
'
frmRediger.Show
End Sub
Sub GemVersion()
' Aktiveres via Alt + G
'
Dim Uname As String * 255
Dim Result As Boolean
Result = GetUserName(Uname, 255)
If Result Then
Application.UserName = Uname
End If
ActiveDocument.Bookmarks.Item("Dato1").Select
With Selection
.MoveRight unit:=wdSentence, Extend:=wdExtend
If Left(.Text, 4) = "DATO" Then
ActiveDocument.Bookmarks.Item("Dato1").Select
Else
.Delete
End If
End With
Selection.TypeText Text:=Format(Date, "dd.mm.yyyy")
ActiveDocument.Bookmarks.Item("Dato2").Select
With Selection
.MoveRight unit:=wdSentence, Extend:=wdExtend
If Left(.Text, 4) = "DATO" Then
ActiveDocument.Bookmarks.Item("Dato2").Select
Else
.Delete
End If
End With
Selection.TypeText Text:=Format(Date, "dd.mm.yyyy")
ActiveWindow.ActivePane.Close
If Left(Application.Version, 2) = 11 Then
If ActiveWindow.View.SplitSpecial = wdPaneNone Then
ActiveWindow.ActivePane.View.Type = wdPrintView
Else
ActiveWindow.View.Type = wdPrintView
End If
Else
If ActiveWindow.View.SplitSpecial = wdPaneNone Then
ActiveWindow.ActivePane.View.Type = wdPageView
Else
ActiveWindow.View.Type = wdPageView
End If
End If
Application.Dialogs(wdDialogFileSaveVersion).Show
End Sub
Sub VisVersion()
' Aktiveres via Alt + V
'
Application.Dialogs(wdDialogFileVersions).Show
End Sub
Sub Dokumentstyringsblanket()
'
' DokStyrBlanket Makro
' Makro oprettet 29.09.2005 af mimog
'
Application.ScreenUpdating = False
Dim blanket, obsdokument As Document
Dim titel, opbev, obsnr, versi As String
Set obsdokument = Application.ActiveDocument
Set blanket = Documents.Open("I:\MSWord\Skabelon\Arbejdsgruppeskabeloner\Dokumentstyringsblanket.doc")
'Get fieldvalues
obsdokument.Bookmarks("Titel1").Select
With Selection
.MoveRight unit:=wdSentence, Extend:=wdExtend
If .Text <> "" Then
titel = .Text
End If
End With
obsdokument.Tables(2).Cell(2, 2).Select
opbev = Selection.Text
obsdokument.Bookmarks("Filnavn1").Select
With Selection
.MoveRight unit:=wdSentence, Extend:=wdExtend
If .Text <> "" Then
obsnr = .Text
End If
End With
obsdokument.Bookmarks("Vers1").Select
With Selection
.MoveRight unit:=wdSentence, Extend:=wdExtend
If .Text <> "" Then
versi = .Text
End If
End With
obsdokument.Bookmarks("Start").Select
obsdokument.ActiveWindow.View.Type = wdPrintView
'Set in fieldvalues
blanket.Bookmarks("Titel").Select
Selection.TypeText (titel)
blanket.Bookmarks("Opbevaring").Select
Selection.TypeText (opbev)
blanket.Bookmarks("OBSnummer").Select
Selection.TypeText (obsnr)
blanket.Bookmarks("Version").Select
Selection.TypeText (versi)
blanket.Bookmarks("Antalsider").Select
Selection.TypeText (obsdokument.BuiltInDocumentProperties(wdPropertyPages))
blanket.Bookmarks("Dato").Select
Selection.TypeText (Date)
blanket.Bookmarks("Udsendtdato").Select
Selection.TypeText (Date)
Application.ScreenUpdating = True
End Sub