Prev: Borderless form
Next: A macro to increase line spacing
From: andreas on 17 Jan 2010 12:49 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 ...............................
From: Fumei2 via OfficeKB.com on 18 Jan 2010 16:12 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
From: andreas on 19 Jan 2010 18:39 On Jan 18, 10:12 pm, "Fumei2 via OfficeKB.com" <u53619(a)uwe> wrote: > 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 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 = RGB(79, 129, 189) to new values using an Input Box. This one and the same constant is used in several macros. Regards, Andreas ..
|
Pages: 1 Prev: Borderless form Next: A macro to increase line spacing |