Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Page color not showing color

Posted on 2012-12-29
8
Medium Priority
?
531 Views
Last Modified: 2012-12-30
Using Word with VBA, I have a program that creates a document similar to another open document. To distinguish the two, I add some code that specifies a tan page color (excuse the bad formatting; my fault):
        ActiveDocument.Background.Fill.ForeColor.ObjectThemeColor = color:
        wdThemeColorBackground2 color:
        ActiveDocument.Background.Fill.ForeColor.TintAndShade = -0.1
color:
        ActiveDocument.Background.Fill.Visible = msoTrue
        ActiveDocument.Background.Fill.Solid.

It does not seem to change the background at all as shown on the screen, yet when printed or when viewed in Full Screen Reading, the tan color shows clearly.
What am I doing wrong?

j.r.a.
0
Comment
Question by:JohnRobinAllen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 22

Expert Comment

by:Flyster
ID: 38730152
I was getting the same results as you. I then went to the Page Layout tab and under Page Background selected Page Color – White Background. I ran your code again and it was working. If this works for you and you would like to know why….. Sorry, I can’t help there. I’m just filing this one under P.D.L. (Pure Dumb Luck)!!

Flyster
0
 
LVL 13

Expert Comment

by:themrrobert
ID: 38730242
Yea, I also noticed the code started working after i played with the background settings, however the color the code changed it to, was not the same color as the background color was in the reading pane before. (I use Word 2007)

It definitely seems like it's (Word is) a bit buggy when it comes to background color, but that's microsoft for you.  

good luck
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

Author Comment

by:JohnRobinAllen
ID: 38730265
The problem may be with my computer. The sample file below illustrates the problem on my computer. May I ask if it gives you the same problem: background appears white unless printed or viewed in full screen reading mode?
     I can easily change the background manually, but my goal is to have VBA do the changes. I recorded a macro to make such changes, and it works fine. The recorded code, however, produces a file like the one attached below.
     This morning I did some work with copying modules from one document to another, and that may have wreaked havoc on my machine. I'll know more if others do not have the problem I described when they load up the document below.

j.r.a.
Sample.docx
0
 
LVL 22

Expert Comment

by:Flyster
ID: 38730418
OK, when I opened this document, it was white. I went to Page Layout - Page Color - More Color. It was showing the currrent color as brown. When I selected OK, the document turned brown. This happened both on Word 2007 and 2010.
Sample2.docx
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 38730580
By default, page backgrounds are not displayed, so you need a line like this:
    ActiveWindow.View.DisplayBackgrounds = True
in the code.
0
 

Author Closing Comment

by:JohnRobinAllen
ID: 38730787
Flyster’s comment Posted on 2012-12-30 at 00:16:12 is accurate, and I had done that also. It doesn’t help. My question wasto be able to make the change using VBA.

     Graham Skan’s one-line solution works perfectly and solves the problem. Mr. Skan made a suggestion on another problem I had, and his suggestion was close to the correct solution. Unfortunately I had written my acceptance of the solution awarding 500 points to someone else before I saw Graham’s solution. 250 of those points should have gone to Graham. I am therefore boosting the number of points awarded for this solution to 500, which returns 205 of the points I should have awarded earlier.

     Even without that background, the one-line solution is so elegant, it deserves the maximum number of points anyway. Thanks, always, the contributions of G.S. to E.E.

     j.r.a. in Priddis (Alberta)
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 38730882
Thanks j.r.a. It wasn't really a problem. As you said, Chris had already pointed to the answer, and you made it clear what the answer was by posting the final code.
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is often necessary in this forum and others to illustrate Word fields as text with the field delimiters replaced with the curly brackets that the delimiters resemble when field codes are being displayed on the document. This means that the text c…
I'm writing to share my clumsy experience in using this elegant tool so you can avoid every stupid mistake I made. (I leave it to the authorities to decide if this deserves a place in the Knowledge archives.)  Now that I am on the other side of my l…
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question