Computer Forum Forum Index
Register  FAQ Profile Log in to check your private messages Log in Register 

help with text find then message box

 
Post new topic   Reply to topic    Computer Forum Forum Index -> microsoft word vba beginners
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Tue Nov 13, 2007 11:50 am    Post subject: help with text find then message box Reply with quote

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





PostPosted: Tue Nov 13, 2007 11:50 am    Post subject: Advertisement

Back to top
Guest






PostPosted: Tue Nov 13, 2007 1:45 pm    Post subject: Re: help with text find then message box Reply with 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
Graham Mayor
Guest





PostPosted: Tue Nov 13, 2007 2:07 pm    Post subject: Re: help with text find then message box Reply with quote

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






PostPosted: Tue Nov 13, 2007 2:14 pm    Post subject: Re: help with text find then message box Reply with 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
Graham Mayor
Guest





PostPosted: Tue Nov 13, 2007 2:43 pm    Post subject: Re: help with text find then message box Reply with quote

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 Sad 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
Display posts from previous:   
Post new topic   Reply to topic    Computer Forum Forum Index -> microsoft word vba beginners All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Computer Forum