![]() |
|
#1
|
||||
|
||||
![]()
Hi Jennifer,
The code runs just fine for me, on both Word 2003 & 2010. Maybe there's a problem with your document or your Word 2007 installation. Repairing Word (Word Options|Resources|Diagnose) may help. I note that you've declared your variables thus: Code:
Dim SettingBreakOld, SettingAutoFitOld, SettingFontSw, SettingFontOld, _ SettingHdrRowSw, SettingHdrRowOld, SettingHdrBrdrOffSw, SettingSelectTableSw _ As Boolean 'Setting variables Dim Msg, MsgAutoFit, MsgBreak, MsgHdrRow, MsgFont, MsgBorder As String I also note that, with the borders for example, you have an option to delete them or leave them alone. IMHO it would be better to allow the user to choose to have or not have the borders, including on a table that presently lacks them. In that case, you'd need something like: Code:
Dim Bdr As Long If SettingHdrBrdrOffSw Then 'If no header row borders, turn all but bottom off Bdr = 0 MsgBorder = "Header row borders off" Else Bdr = 1 MsgBorder = "Header row borders on" End If With .Rows(1) .Borders(wdBorderTop).LineStyle = Bdr .Borders(wdBorderLeft).LineStyle = Bdr .Borders(wdBorderRight).LineStyle = Bdr .Borders(wdBorderVertical).LineStyle = Bdr .Borders(wdBorderDiagonalDown).LineStyle = Bdr .Borders(wdBorderDiagonalUp).LineStyle = Bdr End With If SettingSelectTableSw Then Selection.Tables(1).Select 'Leave table selected? to: If SettingSelectTableSw Then .Select 'Leave table selected?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#2
|
||||
|
||||
![]()
Dang. You are right about the Dim statement. I looked on the MSFT website:
http://msdn.microsoft.com/en-us/library/7ee5a7s1(v=vs.80).aspx and found this paragraph. Different Types. You can specify different data types for different variables by using a separate As clause for each variable you declare. Alternatively, you can declare several variables to be of the same type by using a common As clause. Each variable takes the data type specified in the first As clause encountered after its variablename part. It sure seems to me to say that I can group them as I did. They even give this example: Code:
Dim a, b, c As Single, x, y As Double, i As Integer ' a, b, and c are all Single; x and y are both Double I ran the diagnostics. It found no errors. I don't need those 2 lines, so I'll just delete them. As for the borders, I would do as you suggest it I were writing this for general use. It's just for me and mainly for one project where I need the tables to look a certain way. I don't need every option. Anyway, thanks for all your help. |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
KIM SOLIS | Excel | 2 | 11-04-2011 06:09 PM |
![]() |
RBusiness | Word | 1 | 06-07-2011 04:26 PM |
![]() |
b0x4it | Word VBA | 2 | 05-26-2011 06:25 AM |
Table - Check Boxes - Create Select All | lajohn1963 | Word Tables | 2 | 09-25-2010 11:18 AM |
![]() |
Styler001 | Word | 4 | 01-25-2010 06:40 PM |