| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Tue Nov 13, 2007 11:50 am Post subject: help with text find then message box |
|
|
If Selection.Find.Text = "text" = True Then
MsgBox ("hello")
this looks wrong is wrong but i don't know why |
|
| Back to top |
|
 |
Google Sponsor

|
Posted: Tue Nov 13, 2007 11:50 am Post subject: Advertisement |
|
|
|
|
| Back to top |
|
 |
Guest
|
Posted: Tue Nov 13, 2007 1:45 pm Post subject: Re: help with text find then message box |
|
|
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 |
|
| Back to top |
|
 |
Graham Mayor Guest
|
Posted: Tue Nov 13, 2007 2:07 pm Post subject: Re: help with text find then message box |
|
|
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
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
matthew.rodwell@luptonfawcett.com wrote:
| Quote: | 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 |
|
|
| Back to top |
|
 |
Guest
|
Posted: Tue Nov 13, 2007 2:14 pm Post subject: Re: help with text find then message box |
|
|
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 |
|
| Back to top |
|
 |
Graham Mayor Guest
|
Posted: Tue Nov 13, 2007 2:43 pm Post subject: Re: help with text find then message box |
|
|
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
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
matthew.rodwell@luptonfawcett.com wrote:
| Quote: | 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 |
|
|
| Back to top |
|
 |
|