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 / January 2005

Tip: Looking for answers? Try searching our database.

Make VISIBLE header graphic NON-printable

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brady - 19 Jan 2005 10:53 GMT
I am running Word 2000 SP-3 on Windows XP SP2.

Is there a way of making a .tif graphic viewable in the header of a
mail-merge document onscreen but invisible when the document prints? I use an
Access 2000 database as the data source for form letters. Professionally
printed stationary used for correspondence already contains company logo and
contact info at the top of the sheet. I have a .tif file (that looks just
like the top of the stationary) that I want to put in the header of the
mail-merge document so as to see how the entire document will look when
printed. The database will be distributed to users with various versions of
Office (2000, XP & 2003).

I received some help at another newsgroup that was unsuccessful. I was told
to put the graphic in the header as an inline shape. Then, on the Format menu
set the text to Hidden. I was also reminded to make sure the top margin is
large enough. The code below only works after selecting Compile Project from
the Debug menu in the VB Editor. However, it does not run automatically when
the document is opened.

Private Sub Document_Open()
   Dim strVersion As String
   strVersion = Application.Version
   strVersion = Left(strVersion, InStr(strVersion, ".") - 1)
   ActiveWindow.View.ShowHiddenText = True
   ThisDocument.Sections(1).Headers(wdHeaderFooterPrimary) _
       .Range.Paragraphs(1).Range.Font.Hidden = (CLng(strVersion) > 8)
End Sub

When the mail-merge document is opened, I would like the .tif graphic to be
visible but non-printable. Is there a way?

Thanks!
Brady
Jean-Guy Marcil - 19 Jan 2005 14:56 GMT
Brady was telling us:
Brady nous racontait que :

> I am running Word 2000 SP-3 on Windows XP SP2.
>
[quoted text clipped - 27 lines]
> When the mail-merge document is opened, I would like the .tif graphic
> to be visible but non-printable. Is there a way?

Where is your Document_Open macro located?

It has to be in the ThisDocument module if you want it to execute
automatically when the document is opened.

Signature

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

Brady - 20 Jan 2005 02:53 GMT
Thank you Jean-Guy for your response. Yes, the code I described IS in the
ThisDocument module. However, when the document opens, the .tif graphic is
hidden. Only after the code is compiled manually using the VB Editor does it
behave properly. I did not write the code myself. I have hardly any
experience at all writing macros in Word. All my VB experience has been using
Access. However, my expertise rating is probably only "intermediate" using VB.
To me it seems ambiguous though to have 2 lines with contradicting
definitions:

strVersion = Application.Version
strVersion = Left(strVersion, InStr(strVersion, ".") - 1)

Could that be the problem? Or do you have any other suggestions?
Thanks!
Brady

> Brady was telling us:
> Brady nous racontait que :
[quoted text clipped - 35 lines]
> It has to be in the ThisDocument module if you want it to execute
> automatically when the document is opened.
Jean-Guy Marcil - 20 Jan 2005 06:09 GMT
Brady was telling us:
Brady nous racontait que :

> Thank you Jean-Guy for your response. Yes, the code I described IS in
> the ThisDocument module. However, when the document opens, the .tif
[quoted text clipped - 9 lines]
>
> Could that be the problem? Or do you have any other suggestions?

No, if the macro is in the ThisDocument module, it should run.

   strVersion = Application.Version
   strVersion = Left(strVersion, InStr(strVersion, ".") - 1)
If you are using Office 2003:
   strVersion = 11.0
   strVersion = Left(11.0, InStr(11.0, ".") - 1) = 11

This is a fancy way to get the hidden text to true in the following line:
   ThisDocument.Sections(1).Headers(wdHeaderFooterPrimary) _
       .Range.Paragraphs(1).Range.Font.Hidden = (CLng(strVersion) > 8)
is
   ThisDocument.Sections(1).Headers(wdHeaderFooterPrimary) _
       .Range.Paragraphs(1).Range.Font.Hidden = (CLng(11) > 8)
is
   ThisDocument.Sections(1).Headers(wdHeaderFooterPrimary) _
       .Range.Paragraphs(1).Range.Font.Hidden = (11 > 8)
is
   ThisDocument.Sections(1).Headers(wdHeaderFooterPrimary) _
       .Range.Paragraphs(1).Range.Font.Hidden = True

I do not now why it was written this way... If you are using Word 97, hidden
text will be set to False.

Without more to go on, I cannot say why it isn't working.

Is the code in a template or in a document?
If you put a Stop at the beginning of the code, does the code Stop when you
open a document, or is it totally ignored?

Signature

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

Brady - 21 Jan 2005 14:47 GMT
Jean-Guy,
Sorry to take so long to get back to you but the Discussion Group site
evidently had some problems yesterday and I was unable to reply.

Your last message solved my problem. Much Thanks! When I ran the Stop, upon
reopening the document a message appeared notifying me that Word's Security
Level was set to High, thus disabling all unsigned macros (like I told you, I
am not very experienced with programming Word). Anyway, I changed the level
and then resaved the document under another name. All went well.

The funny thing is that when I reset Word's Security back to High and
re-opened the document... it still worked. I don't know why, but I am not
complaining.

By the way, just for the record, in answer to your last query, it was a .doc
file, not a template.

Thanks again for all your help!
Brady

> Brady was telling us:
> Brady nous racontait que :
[quoted text clipped - 42 lines]
> If you put a Stop at the beginning of the code, does the code Stop when you
> open a document, or is it totally ignored?
 
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.