Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2005

Tip: Looking for answers? Try searching our database.

Help in finding the next 'S'

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ben - 06 Feb 2005 14:55 GMT
Hi,
I have  code that actually find the 1st 'S' of the document where it will
cut and paste to new document. Can i coded in vb that it will find the next
'S' and  cut and paste instead.

With Selection.Find
       .Execute FindText:="<[S]????????>", MatchWildcards:=True,
MatchWholeWord:=True, Wrap:=wdFindContinue, Forward:=True
       'MsgBox "!"
     'Invoke the SaveAs box
     With Dialogs(wdDialogFileSaveAs)
      .Name = Trim$(Selection.Text)
      .Show
     End With
 
 End With

Tks
regards,
Ben
Doug Robbins - 06 Feb 2005 16:05 GMT
Use this type of construction

Dim i As Long
i = 0
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
   Do While .Execute(FindText:="<[S]????????>", MatchWildcards:=True,
Wrap:=wdFindStop, Forward:=True) = True
       i = i + 1
       If i = 2 Then
           Exit Do
       End If
   Loop
End With
MsgBox Selection.Text

Signature

Please respond to the Newsgroup for the benefit of others who may be
interested.   Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP

> Hi,
> I have  code that actually find the 1st 'S' of the document where it will
[quoted text clipped - 17 lines]
> regards,
> Ben

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.