V
vonclausowitz
Hi All,
I have a VB application which opens a word file to search for some text
strings.
At home there is no problem but when I try this code at work on a
win2000 machine with office
2000 installed it crashed somewhere at this line:
Do Until sFile = ""
sFileoud = sFile
Tekst1.Text = sFileoud
Tekst3.Text = ""
Me.Refresh
lCounter = lCounter + 1
Set olWordDocs = olApplication.Documents.Open(FileName:=oDisk + sFile,
ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
WritePasswordDocument:="", WritePasswordTemplate:="", Format:=
_
wdOpenFormatAuto)
If olApplication.ActiveDocument.ProtectionType <>
wdNoProtection Then
olApplication.ActiveDocument.Unprotect
End If
olApplication.Selection.Find.ClearFormatting
With olApplication.Selection.Find
.Text = "MSGID"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
olApplication.Selection.Find.Execute
olApplication.Selection.MoveRight Unit:=wdCharacter,
Count:=3
olApplication.Selection.EndKey Unit:=wdLine,
Extend:=wdExtend
sRefnr = ""
sRefnr = olApplication.Selection
Does anyone know what is wrong here?
Regards
Marco
I have a VB application which opens a word file to search for some text
strings.
At home there is no problem but when I try this code at work on a
win2000 machine with office
2000 installed it crashed somewhere at this line:
Do Until sFile = ""
sFileoud = sFile
Tekst1.Text = sFileoud
Tekst3.Text = ""
Me.Refresh
lCounter = lCounter + 1
Set olWordDocs = olApplication.Documents.Open(FileName:=oDisk + sFile,
ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
WritePasswordDocument:="", WritePasswordTemplate:="", Format:=
_
wdOpenFormatAuto)
If olApplication.ActiveDocument.ProtectionType <>
wdNoProtection Then
olApplication.ActiveDocument.Unprotect
End If
olApplication.Selection.Find.ClearFormatting
With olApplication.Selection.Find
.Text = "MSGID"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
olApplication.Selection.Find.Execute
olApplication.Selection.MoveRight Unit:=wdCharacter,
Count:=3
olApplication.Selection.EndKey Unit:=wdLine,
Extend:=wdExtend
sRefnr = ""
sRefnr = olApplication.Selection
Does anyone know what is wrong here?
Regards
Marco