Private WordServer As Word.Application
Private Sub Command1_Click()
Dim file_name As String
Dim file_path As String
Dim file_title As String
Dim txt As String
Dim new_txt As String
Dim pos As Integer
Screen.MousePointer = vbHourglass
Command1.Enabled = False
DoEvents
file_name = txtFilename.Text
file_title = Mid$(file_name, InStrRev(file_name, "\") + _
1)
file_path = Left$(file_name, Len(file_name) - _
Len(file_title))
WordServer.Visible = True
WordServer.ChangeFileOpenDirectory file_path
WordServer.Documents.Open _
FileName:=file_title, _
ConfirmConversions:=False, _
ReadOnly:=False, _
AddToRecentFiles:=False, _
PasswordDocument:="", _
PasswordTemplate:="", _
Revert:=False, _
WritePasswordDocument:="", _
WritePasswordTemplate:="", _
Format:=wdOpenFormatAuto
WordServer.Selection.GoTo _
What:=wdGoToBookmark, _
Name:="Disclaimer"
WordServer.Selection.Find.ClearFormatting
With WordServer.Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
WordServer.Selection.TypeText _
Text:="<Here is the bookmark>"
Screen.MousePointer = vbDefault
Command1.Enabled = True
End Sub
|