Solved

Page color not showing color

Posted on 2012-12-29
8
511 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
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 13

Expert Comment

by:themrrobert
Comment Utility
0
 
LVL 22

Expert Comment

by:Flyster
Comment Utility
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
Comment Utility
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
 

Author Comment

by:JohnRobinAllen
Comment Utility
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 22

Expert Comment

by:Flyster
Comment Utility
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 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

If you work with Word a lot, you probably use styles. If you use styles a lot, you've probably balled your fist more often than not when working with the ribbon. In Word 2007/2010, one of the things that I find missing when using styles is a quic…
Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now