help with text find then message box

M

matthew.rodwell

If Selection.Find.Text = "text" = True Then
MsgBox ("hello")

this looks wrong is wrong but i don't know why
 
M

matthew.rodwell

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
 
G

Graham Mayor

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.

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
M

matthew.rodwell

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
 
G

Graham Mayor

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.

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top