Changing Constants in several macros in one go

Dear Experts:

For a table macro (see below) I have defined two constants ...
.... strConstantBlue: representing the RGB value for borders,
.... strConstantBlue_2: representing the RGB value for background
pattern color.

I got SEVERAL similar table macros all with the SAME constants, i.e.
.... strConstantBlue and
.... strConstantBlue_2.

How can I set NEW values for these two constants in all the affected
macros in one go, using an InputBox?

That is, after entering the new values for the constant
<strConstantBlue>, say (44,33,22), the values for these constants have
to be reset in all user defined table macros. Let's assume the three
macros in question are named "Tbl_Styling_Blue", "Tbl_Styling_Blue_2
and Tbl_Styling_Blue_3.

Help is much appreciated. Thank you very much in advance.

Regards, Andreas





_____________________

Code Snippet

_____________________

Sub Tbl_Styling_Blue()

Dim myTable As Word.Table
Dim rng As Word.Range

Dim strConstantBlue As String
strConstantBlue = RGB(79, 129, 189)

Dim strConstantBlue_2 as String
strConstantBlue_2 = RGB(216, 227, 240)
........

Set myTable = Selection.Tables(1)
With myTable.rows(1)
..Borders(wdBorderTop).LineStyle = wdLineStyleSingle
..Borders(wdBorderTop).LineWidth = wdLineWidth050pt
..Borders(wdBorderTop).Color = strConstantBlue
End With

With myTable.rows.Last
 With .Borders(wdBorderBottom)
      .LineStyle = wdLineStyleSingle
      .LineWidth = wdLineWidth050pt
      .Color = strConstantBlue_2
  End With
End With

...............................
0
andreas
1/17/2010 5:49:57 PM
word.vba.general 1023 articles. 1 followers. Follow

2 Replies
987 Views

Similar Articles

[PageSpeed] 59

If you are changing values, how can they be CONSTANTS.  Constants are not
supposed to change.  That is what makes them constants, they constantly stay
the same value.

The only way - at least using "constants" - would be to use the code writing
ability of VBA to delete the constant line, and write a new one.

andreas wrote:
>Dear Experts:
>
>For a table macro (see below) I have defined two constants ...
>... strConstantBlue: representing the RGB value for borders,
>... strConstantBlue_2: representing the RGB value for background
>pattern color.
>
>I got SEVERAL similar table macros all with the SAME constants, i.e.
>... strConstantBlue and
>... strConstantBlue_2.
>
>How can I set NEW values for these two constants in all the affected
>macros in one go, using an InputBox?
>
>That is, after entering the new values for the constant
><strConstantBlue>, say (44,33,22), the values for these constants have
>to be reset in all user defined table macros. Let's assume the three
>macros in question are named "Tbl_Styling_Blue", "Tbl_Styling_Blue_2
>and Tbl_Styling_Blue_3.
>
>Help is much appreciated. Thank you very much in advance.
>
>Regards, Andreas
>
>_____________________
>
>Code Snippet
>
>_____________________
>
>Sub Tbl_Styling_Blue()
>
>Dim myTable As Word.Table
>Dim rng As Word.Range
>
>Dim strConstantBlue As String
>strConstantBlue = RGB(79, 129, 189)
>
>Dim strConstantBlue_2 as String
>strConstantBlue_2 = RGB(216, 227, 240)
>.......
>
>Set myTable = Selection.Tables(1)
>With myTable.rows(1)
>.Borders(wdBorderTop).LineStyle = wdLineStyleSingle
>.Borders(wdBorderTop).LineWidth = wdLineWidth050pt
>.Borders(wdBorderTop).Color = strConstantBlue
>End With
>
>With myTable.rows.Last
> With .Borders(wdBorderBottom)
>      .LineStyle = wdLineStyleSingle
>      .LineWidth = wdLineWidth050pt
>      .Color = strConstantBlue_2
>  End With
>End With
>
>..............................

-- 
Message posted via http://www.officekb.com

0
Fumei2
1/18/2010 9:12:01 PM
On Jan 18, 10:12=A0pm, "Fumei2 via OfficeKB.com" <u53619@uwe> wrote:
> If you are changing values, how can they be CONSTANTS. =A0Constants are n=
ot
> supposed to change. =A0That is what makes them constants, they constantly=
 stay
> the same value.
>
> The only way - at least using "constants" - would be to use the code writ=
ing
> ability of VBA to delete the constant line, and write a new one.
>
>
>
>
>
> andreas wrote:
> >Dear Experts:
>
> >For a table macro (see below) I have defined two constants ...
> >... strConstantBlue: representing the RGB value for borders,
> >... strConstantBlue_2: representing the RGB value for background
> >pattern color.
>
> >I got SEVERAL similar table macros all with the SAME constants, i.e.
> >... strConstantBlue and
> >... strConstantBlue_2.
>
> >How can I set NEW values for these two constants in all the affected
> >macros in one go, using an InputBox?
>
> >That is, after entering the new values for the constant
> ><strConstantBlue>, say (44,33,22), the values for these constants have
> >to be reset in all user defined table macros. Let's assume the three
> >macros in question are named "Tbl_Styling_Blue", "Tbl_Styling_Blue_2
> >and Tbl_Styling_Blue_3.
>
> >Help is much appreciated. Thank you very much in advance.
>
> >Regards, Andreas
>
> >_____________________
>
> >Code Snippet
>
> >_____________________
>
> >Sub Tbl_Styling_Blue()
>
> >Dim myTable As Word.Table
> >Dim rng As Word.Range
>
> >Dim strConstantBlue As String
> >strConstantBlue =3D RGB(79, 129, 189)
>
> >Dim strConstantBlue_2 as String
> >strConstantBlue_2 =3D RGB(216, 227, 240)
> >.......
>
> >Set myTable =3D Selection.Tables(1)
> >With myTable.rows(1)
> >.Borders(wdBorderTop).LineStyle =3D wdLineStyleSingle
> >.Borders(wdBorderTop).LineWidth =3D wdLineWidth050pt
> >.Borders(wdBorderTop).Color =3D strConstantBlue
> >End With
>
> >With myTable.rows.Last
> > With .Borders(wdBorderBottom)
> > =A0 =A0 =A0.LineStyle =3D wdLineStyleSingle
> > =A0 =A0 =A0.LineWidth =3D wdLineWidth050pt
> > =A0 =A0 =A0.Color =3D strConstantBlue_2
> > =A0End With
> >End With
>
> >..............................
>
> --
> Message posted viahttp://www.officekb.com- Hide quoted text -
>
> - Show quoted text -

Hi Fumei,

thank you very much for your explanations.
As a matter of fact ...
<The only way - at least using "constants" - would be to use the code
writing
ability of VBA to delete the constant line, and write a new one>
 ... this is what I am looking for, i.e. a macro that allows me to re-
set the RGB values of these constants (e.g. strConstantBlue =3D RGB(79,
129, 189) to new values using an Input Box. This one and the same
constant is used in several macros.

Regards, Andreas
..
0
andreas
1/19/2010 11:39:52 PM
Reply:

Similar Artilces:

External data link change
Hi, I've a sheet linked to an external data on the net, and I would like that a cell in this sheet to indicate the last date and time it was updated, the simplest way the better but I can do some programming too. Thanks for your attention, -- Domingos Junqueira No need of help any more, I solved the question. Thanks again ...

Going mad with crm migration
Someone please help, I cannot seem to migrate any kind of data with the migration tool no matter what I do, no matter what table I try to insert values into. For eg I try and manually place one mock product into my cdf_product table with all the required fields and all I ever get is : [ERROR] Failed to migrate object: Exception from HRESULT: 0x80040220. I've tried everything and I mean everything and Ive been on this for a week now, someone please help. I dont want to abandon this product because of a migration problem. All I need to migrate is a bunch of products. How difficul...

Why does the change change to a number?
Hi all, I've noticed something wierd and always wondered WHY it happens. When you type a date into a cell, and then change the Formatting of it to a 'general' cell, it turns into a number. How does it come up with that number? What is the significance? i.e. type today's date of "12/7/2007" - change it to a 'General' format, and it then says "39423". I'm a trainer of Excel and this question always comes up. I'm curious myself too. Thanks! Joe It's the number of days since January zero 1900 using Excel default for windows (M...

How to Unhide or Hide Multiple Sheets at One GO?
Hi Everyone I guess my Subject Title has already said what I need to know. SO is i possible to hide or unhide a selection of worksheets at one go? Cheers Kelvi -- Message posted from http://www.ExcelForum.com Kelvin, Select the sheets to hide, then Format>Sheet>Hide -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "hce >" <<hce.12cnl1@excelforum-nospam.com> wrote in message news:hce.12cnl1@excelforum-nospam.com... > Hi Everyone > > I guess my Subject Title has a...

changing the way Excel displays selected cells
Is there a way to change the way Excel displays selected cells? I'm interested in viewing all the selected cells highlighted (with light blue for instance), but by default excel highlights all the cells but not the first one the same occurs when you define a range with no adyacents cells Your definition of the display is not quite correct. Excel highlights the current cell, Excel also highlights a selecte range. The currently selected cell is generally the first of a range, bu press enter and the current cell changes and becomes the second, the third etc in the range. You cannot...

DST changes for Exchange 5.5
I noticed the 2007 DST Calendar Update "Exchange tool" is available now: http://support.microsoft.com/kb/930879 This will seemingly take care of calendars for mailboxes still on Exchange 5.5 servers, as Exchange 5.5 is listed as "compatible" . However would this address the CDO issues such as BlackBerry users and OWA users still on Exchange 5.5 ? Thanks in advance, Itrcb4 On Mon, 12 Feb 2007 14:31:00 -0800, itrcb4 <itrcb4@discussions.microsoft.com> wrote: >I noticed the 2007 DST Calendar Update "Exchange tool" is available now: > >http://su...

Track Changes
How do i remove the track changes in outlook? When i press "Enter", a symbol that represents "Enter" will appears. Same for space etc. ...

more on VBA function name change
I thought I'd start a new thread since I haven't received any replies to my first one... To recap: I've declared a function in a module using mixed case: Function TMDE_Category (FormName As Form) I noticed recently that it appeared in the module as Function tmde_category(FormName As Form) I changed it back to the mixed case declaration, saved the module, exited the app, reopened it and looked. The function had changed back to the all lowercase declaration. Things I've tried since the original post: Using the databse documenter, I selected all ob...

Can't Publish changes with Deploy Manager
After a migration process, I can't publish the changes made on CRM. When I try do this in Deploy Manager I get the follow error: ---------------------------------------------------------------------------- ----- Publish done with errors. See the event log to get deitails NETRA-INOVACAO: ***Error*** Failed to download XSL template files from Web Server ---------------------------------------------------------------------------- ----- Can somebody help me? I don't know if the migration process have any relationship with the error. Thank you for pay attention. []'s Vin�cius Pitta...

Code in a macro to branch to another macro?
I wonder if someone can help me with a little code for inclusion in a macro? It needs to do the following: “If cell in column D on this row = "Sunday", perform Macro “Sunday”, otherwise execute macro “Weekday”” Background info: I run an accounting system on a series of worksheets. The Cash Journal dynamically applies the week of the year and day of the week (based on the first date in the financial year) and conditionally formats rows accordingly to highlight weekends. Macros post the daily cashup sheet to the Cash Journal and General journal. I am combining the...

witch one should i get
Hi im Sam i want to buy the latest ms money but witch one should i get i want every can someone compare with Microsoft Money 2006 Standard and Microsoft Money 2006 Premium and Microsoft Money 2006 Deluxe or Microsoft Money 2006 Small Business please would someone help be to decide the best one thank you Sam M06 is two versions obsolete hence two versions closer to being unsupported/disabled from online services. Deluxe is fine for most people. Premium adds some features of slight value to some and large value to others. If you do not have a business need, do not get the business editi...

How to change icon for my application
Hi, I am currently developing an application on visual studio 6.0, and i wish to change the MFC icon on my application header. Anyone can help? Thank you. Raed Sawalha wrote: > Hi, I am currently developing an application on visual studio 6.0, and i > wish to change the MFC icon on my application header. Anyone can help? Thank > you. > > Open the icon resource for editing by double clicking. Then notice the control just above the editing grid that lets you switch between editing the large icon and editing the small one. -- Scott McPhillips [VC++ MVP] thanx that work...

How to change newsgroup message font
Like many other ribbon based programs I sometimes struggle to find how to make a change. This time its how to change the font just for newsgroup messages? regards "nobody" wrote in message news:EWTao.39493$GF5.7129@hurricane... > Like many other ribbon based programs I sometimes struggle to find how to make a change. This time its how to change the font just for newsgroup messages? Newsgroup messages are usually plain text. The font used is that selected at [no name tab] > Options > Mail > Read > Fonts for the encoding specified for the messag...

Which one first?Install Windows Server 2003 SP1 or Exchange SP2 ?
Hi, We are running Exchange 2003 on Windows Server 2003. We planned to update the software in terms of patches, so which one should I do first, the OS patches (SP1 and onwards) or the Exchange patches ? Rgrds, Zul If it was me do the OS first. "Zul J" <mlist@istar.com.my> wrote in message news:%23AeXnXErFHA.2076@TK2MSFTNGP14.phx.gbl... > Hi, > > We are running Exchange 2003 on Windows Server 2003. We planned to update > the software in terms of patches, so which one should I do first, the OS > patches (SP1 and onwards) or the Exchange patches ? > ...

Removing a custom Toolbar Button & macro
I've put macro in module, then make a custom button on the toolbar to invoke a macro.(according to excel help) -------------------------------------- Create a toolbar button that runs your macro 1. On the Tools menu, click Customize, and then click the Commands tab. 2. Under Categories, click Macros. 3. Drag the custom button to the toolbar where you want it. 4. On the Customize dialog box, click Modify Selection, and then click Assign Macro. 5. In the Assign Macro dialog box, click the nam...

Notify change of email address when changing ISP
How do I notify my entire address book of an email address when I change ISP's? Thanks By sending a mail to everyone ? If you do so, please use BCC for the adresses, this way you won't spread everybody's e-mail adres to everybody. Niels Bob Baker wrote: > How do I notify my entire address book of an email address when I change ISP's? > Thanks ...

Change a formula to an acual number
I want to change the formula I have created to the number it has created Example: Cell A1 is the number 1. Cell A2 is the formula =a1+1 creatin the number 2. I want this to be a two not a formula. Any ideas? Laura, copy, then paste special, valves -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2000 & 97 ** remove news from my email address to reply by email ** "Laura" <anonymous@discussions.microsoft.com> wrote in message news...

Problem Changing an Investment Name
I am trying to change an investment name and Money 2006 tells me "The name or symbol 'TRP Spectrum Income' has already been used for a deleted investment. Please enter a different name." When I go to delete investments the name does not appear! Any ideas on how I get Money to accept the name change? This is the first time I have run into this situation and I have made numerous name changes in Money over the years. In microsoft.public.money, Ken wrote: >I am trying to change an investment name and Money 2006 tells me "The name >or symbol 'TRP Spec...

Sharing outlook contacts between several workstations
Hi all ! We've got a problem sharing our outlook contacts amongst about 2 workers. We've got Office 2000 on Windows 2000- resp. Windows XP-Workstations We've used so far NetFolders, but they don't seem to work anymore sinc I tried to add some users and it won't let me add more then 20 users. Anyway, in later versions of Office than Office 2000 NetFolders aren' supported anymore, so we were looking for other solutions. At the moment we've got a central .pst-File containing the contact which is copied locally to each workstation by a batch-file once a wee started by ...

Should I change this code?
Should I change 556 to 560???..............Thanks for your help..........Bob Private Sub Command560_Click() On Error GoTo Err_Command556_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "frmClientInfomation" DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_Command556_Click: Exit Sub Err_Command556_Click: MsgBox Err.Description Resume Exit_Command556_Click End Sub On Sun, 15 Jul 2007 16:37:26 +1200, "Bob V" <rjvance@ihug.co.nz> wrote: > >Should I change 556 to 560???..............Thanks for your help.....

How to change default font in Outlook 2003
Can someone tell me how to change tthe default font in Outlook 2003 when composing a new email. It always comes up as Times New Roman. I remember somewhere that I specified that Outlook should use Word as the text editor and that seems to be the case. I have Arial as my default font in Word but this seems to make no difference when using Outlook. Hi, Please go to Tools > Setting > Mail Format > Stationery and Fonts > Fonts It's right there :) On 20 Nov 2005 06:28:45 -0800, amarsarit@gmail.com wrote: >Hi, >Please go to Tools > Setting > Mail Format > Statione...

icon changes with change of extension
when we change the extension of a file in windows, its icon also changes..... how does windows do tht. in my application i require a similar approach. i want the icon to be dependent on the file extension not on the attributes of the file. i have gone trough the registry but things are not very clear. Windows has listed all the file extensions avaliable there, but there is no general way to extract icons for those extension... kindly help icon changes with change of extension "Neelu" <nemesia31@gmail.com> wrote in message news:1161232739.720722.120950@b28g2000cwb.google...

Field Type Change
I am trying to change a free text field to a drop down menu in my current database, that already has data entered for this particular field, in order to avoid multiple versions of the same organization that are just typed in differently. I'm assuming that I'll need to recode the different versions of an entry to make them uniform but after that, I'm unsure how to proceed so I won't lose any data. Is this possible or will I need to delete the field, recreate it as a drop down and then re-enter the data? Thanks in advance! Mike Thanks everyone for all the input and advice s...

macro for repeat task and format interior
Hi All, I'm trying to check out repeated value on column Q and the hightlighted entire cell on the left.I put the code that found from Sample,and trying to modified it but I made a mistake.I can't select entire cell on the left, I just can highlight 2 cell ( offset(0.-3) and the cell on column A).Please help how to select entire cell to the left without interupted by blank cell. And also I want to put the copy of higlighted cell value to a new workbook. Thank's. Rgds, Shiro Sub Duplicate_Serial_Number() Dim eX As Integer Dim cell_in_loop As Range eX = ActiveSheet....

Tracking Changes
I am the author of a document and am making revisions to it. I want to chnage the redline color to denote new edits from the 1st version. Can anyone guide me through this process? I am sure it is easy but I cannot figure it out. THanks Peter On Wed, 10 Feb 2010 07:08:06 -0800, Peter SSI <Peter SSI@discussions.microsoft.com> wrote: >I am the author of a document and am making revisions to it. I want to >chnage the redline color to denote new edits from the 1st version. Can >anyone guide me through this process? I am sure it is easy but I cannot >figure i...