Changing Constants in several macros in one go

A

andreas

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

...............................
 
F

Fumei2 via OfficeKB.com

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.
 
A

andreas

If you are changing values, how can they be CONSTANTS.  Constants are not
supposed to change.  That is what makes them constants, they constantlystay
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.

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 = RGB(79,
129, 189) to new values using an Input Box. This one and the same
constant is used in several macros.

Regards, Andreas
..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top