A Microsoft Word forum. Microsoft Office Word Forum - WordBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Microsoft Office Word Forum - WordBanter forum » Microsoft Word Newsgroups » Microsoft Word Help
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Help with Drop Down Macro to select Document Background Color



 
 
Thread Tools Display Modes
  #1  
Old August 20th 18, 04:53 PM
WordNoob WordNoob is offline
Junior Member
 
First recorded activity by WordBanter: Aug 2018
Posts: 0
Default Help with Drop Down Macro to select Document Background Color

So I am trying to create and office memo template and as part of this based on what the memo is for, the user of the form selects the purpose and it changes the background color of the document.

So I created a Drop-Down List Content Control Named "BackgroundColor" with the Values "Blue" and "Green" for 2 different purposes.

I then wrote a VBA Macro as follows

Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
ActiveDocument.Unprotect
With ActiveDocument
Select Case ActiveDocument.ContentControls("BackgroundColor")
Case "Blue"
ActiveDocument.ActiveWindow.View.DisplayBackground s = True
ActiveDocument.Background.Fill.ForeColor.RGB = RGB(200, 200, 200)
ActiveDocument.Background.Fill.Transparency = 0#
ActiveDocument.Background.Fill.PresetTextured msoTextureParchment
Case "Green"
ActiveDocument.ActiveWindow.View.DisplayBackground s = True
ActiveDocument.Background.Fill.ForeColor.RGB = RGB(100, 100, 100)
ActiveDocument.Background.Fill.Transparency = 0#
ActiveDocument.Background.Fill.PresetTextured msoTextureParchment
Case Else
End Select
ActiveDocument.Protect wdAllowOnlyFormFields, True
End With
End Sub

The Macro fails with Invalid Parameter. Anyone have any idea how to fix it?

I am on Office Professional Plus 2016

Last edited by WordNoob : August 20th 18 at 04:58 PM.
Ads
  #2  
Old August 20th 18, 06:27 PM
Jasonaldean Jasonaldean is offline
Junior Member
 
First recorded activity by WordBanter: May 2018
Posts: 8
Default

I also face this same issue.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
document map background color (W 2003) JPh12 Microsoft Word Help 0 October 29th 10 06:35 PM
color background in a document Jacqueline[_2_] Page Layout 1 October 3rd 09 11:55 AM
The background color won't print with my document. T Maddux Microsoft Word Help 1 August 25th 08 10:39 PM
background color for text document Terrie New Users 1 June 18th 07 04:44 PM
Background color on only one page of a document Paul P Microsoft Word Help 1 April 20th 07 05:30 PM


All times are GMT +1. The time now is 07:05 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright 2004-2018 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.