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 2004

Tip: Looking for answers? Try searching our database.

IF BLANK Macro Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ralph - 26 Nov 2004 13:57 GMT
I have a Macro that runs in MS-Word.  I need to find
out if a document that a user is referencing/opening/using
is BLANK.

If the Document is BLANK notify the user with a message.
If the document is NOT BLANK (i.e more that 10 characters)
notify the user with a message box.

   Can anyone help me?
Jean-Guy Marcil - 26 Nov 2004 15:25 GMT
Ralph was telling us:
Ralph nous racontait que :

> I have a Macro that runs in MS-Word.  I need to find
> out if a document that a user is referencing/opening/using
[quoted text clipped - 3 lines]
> If the document is NOT BLANK (i.e more that 10 characters)
> notify the user with a message box.

If Len(ActiveDocument.Range.Text) < 11 Then
   MsgBox "This document contains less than 11 characters"
Else
   MsgBox "This document contains more than 11 characters"
End If
Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

Greg Maxey - 26 Nov 2004 15:32 GMT
JGM

Is there any advantage by using
Len(ActiveDocument.Range.Text) < 11
over
ActiveDocument.Characters.Count < 11

??

Thanks.
Signature

Greg Maxey/Word MVP
A Peer in Peer to Peer Support

> Ralph was telling us:
> Ralph nous racontait que :
[quoted text clipped - 12 lines]
>    MsgBox "This document contains more than 11 characters"
> End If
Jean-Guy Marcil - 26 Nov 2004 19:07 GMT
Greg Maxey was telling us:
Greg Maxey nous racontait que :

> JGM
>
> Is there any advantage by using
> Len(ActiveDocument.Range.Text) < 11
> over
> ActiveDocument.Characters.Count < 11

Not that I can think of... It is just that this was the first thing that
popped into my mind!

Now that you bring it up, I think that
   ActiveDocument.Characters.Count
would be more accurate for this purpose (If there are tables for example,
the End of Cell marker will be counted as 2 characters by the Len function,
but as one by Characters.Count.)
Since he was talking about an almost blank document, I did not really think
that deep!
Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

Greg Maxey - 26 Nov 2004 19:23 GMT
JGM,

OK, thanks.  I wasn't sure.

Signature

Greg Maxey/Word MVP
A Peer in Peer to Peer Support

> Greg Maxey was telling us:
> Greg Maxey nous racontait que :
[quoted text clipped - 16 lines]
> Since he was talking about an almost blank document, I did not really
> think that deep!
Jean-Guy Marcil - 26 Nov 2004 15:31 GMT
Ralph was telling us:
Ralph nous racontait que :

> I have a Macro that runs in MS-Word.  I need to find
> out if a document that a user is referencing/opening/using
[quoted text clipped - 3 lines]
> If the document is NOT BLANK (i.e more that 10 characters)
> notify the user with a message box.

Please do not multipost.

If you want  you can crosspost (Many newsgroups in the To: field when you
create your message.)

The reason is simple:
People may end up "wasting" their time answering a post that has already
been answered elsewhere, thus it may be very likely that their particular
response to a post be totally ignored if the reply received elsewhere was
satisfactory to the original poster.
Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

 
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.