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 / November 2007

Tip: Looking for answers? Try searching our database.

help with text find then message box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
matthew.rodwell@luptonfawcett.com - 13 Nov 2007 11:50 GMT
If Selection.Find.Text = "text" = True Then
   MsgBox ("hello")

this looks wrong is wrong but i don't know why
matthew.rodwell@luptonfawcett.com - 13 Nov 2007 13:45 GMT
Ok the code below works but it still doesn't look for the word in the
text box.any ideas?

Selection.Find.ClearFormatting
With Selection.Find
  .Text = "xxxx"
  .Replacement.Text = ""
  .Forward = True
  .Wrap = wdFindContinue
  .Format = False
  .MatchCase = False
  .MatchWholeWord = False
  .MatchWildcards = False
  .MatchSoundsLike = False
  .MatchAllWordForms = False
End With
Selection.Find.Execute
If Selection.Find.Found = True Then
  MsgBox ("STOP: This is a Letter. Please send to another printer.")
GoTo lastbit:
End If
Graham Mayor - 13 Nov 2007 14:07 GMT
It appears this macro is intended to look for a text string xxxx and if
found pop up a message box about the printer (which it does as written).
Wouldn't it be simpler just to set the required printer by intercepting the
print routine in the document template, so that the problem doesn't arise
and the users are not confused?

See http://www.gmayor.com/fax_from_word.htm for methods of controlling
printer selection.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Ok the code below works but it still doesn't look for the word in the
> text box.any ideas?
[quoted text clipped - 17 lines]
> GoTo lastbit:
> End If
matthew.rodwell@luptonfawcett.com - 13 Nov 2007 14:14 GMT
the problem we have is the docuements are created from a program that
merges into word...the docuemnts must then be printed to this certain
printer as it is different letter headed paper BUT other work they do
may not have to be printed on this paper ...hope u see
Graham Mayor - 13 Nov 2007 14:43 GMT
Then just add a button to the document template (or a global template) to
print the document - as described in the linked page.

As explained in the other thread :( you will have to intercept the print
routine to establish whether the document is being printed on the correct
printer in order to warn the user, so rather than warn, set the correct
printer.

This might be an issue if the application uses normal.dot as a template to
create its documents as you will not want to intercept the print routines
for every document you print, so add the button and tell your users to use
it to print the document.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> the problem we have is the docuements are created from a program that
> merges into word...the docuemnts must then be printed to this certain
> printer as it is different letter headed paper BUT other work they do
> may not have to be printed on this paper ...hope u see
 
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.