V
vonclausowitz
This Q was posted earlier in microsoft.public.vb.general.discussion.
Veign,
Saw the code, looks good, tried it but couldn't get it to work, need a
little hand.
Do While rstNaam.EOF = False
For Each myStoryRange In ActiveDocument.StoryRanges
With myStoryRange.Find
.Text = rstNaam("zoekstring")
.Replacement.Text = ""
.Wrap = wdFindContinue
.Execute Replace:=wdReplaceAll
End With
Do While Not (myStoryRange.NextStoryRange Is Nothing)
Set myStoryRange = myStoryRange.NextStoryRange
With myStoryRange.Find
.Text = rstNaam("zoekstring")
.Replacement.Text = ""
.Wrap = wdFindContinue
.Execute Replace:=wdReplaceAll
End With
Loop
Next myStoryRange
||||||||||||||||||||||||||||||||||| next part won't work
|||||||||||||||||||||||||||||||||||||||||||||||||||
If myStoryRange.Find.Execute = True Then
sTempNaam = rstNaam("bestandsnaam")
Exit Do
End If
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rstNaam.MoveNext
Loop
How should I go about?
I want to search the doc for the rstNaam("zoekstring"), and when it is
found
this will become the name of the document:
With wdApp
With .Dialogs(wdDialogFileSaveAs)
.Name = gDiskLetter & sTempNaam & Format(Date,
"YYYYMMDD")
.Show
End With
End With
like this.
Marco
Veign,
Saw the code, looks good, tried it but couldn't get it to work, need a
little hand.
Do While rstNaam.EOF = False
For Each myStoryRange In ActiveDocument.StoryRanges
With myStoryRange.Find
.Text = rstNaam("zoekstring")
.Replacement.Text = ""
.Wrap = wdFindContinue
.Execute Replace:=wdReplaceAll
End With
Do While Not (myStoryRange.NextStoryRange Is Nothing)
Set myStoryRange = myStoryRange.NextStoryRange
With myStoryRange.Find
.Text = rstNaam("zoekstring")
.Replacement.Text = ""
.Wrap = wdFindContinue
.Execute Replace:=wdReplaceAll
End With
Loop
Next myStoryRange
||||||||||||||||||||||||||||||||||| next part won't work
|||||||||||||||||||||||||||||||||||||||||||||||||||
If myStoryRange.Find.Execute = True Then
sTempNaam = rstNaam("bestandsnaam")
Exit Do
End If
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rstNaam.MoveNext
Loop
How should I go about?
I want to search the doc for the rstNaam("zoekstring"), and when it is
found
this will become the name of the document:
With wdApp
With .Dialogs(wdDialogFileSaveAs)
.Name = gDiskLetter & sTempNaam & Format(Date,
"YYYYMMDD")
.Show
End With
End With
like this.
Marco