Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #9  
Old 01-29-2012, 06:15 PM
macropod's Avatar
macropod macropod is offline How to select the first row of the current table Windows 7 64bit How to select the first row of the current table Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,382
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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
You should be aware that this means that all except SettingSelectTableSw and MsgBorder are Variants.

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
BTW, you could reduce:
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]
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to select the first row of the current table How to call current PC date and/or current PC year KIM SOLIS Excel 2 11-04-2011 06:09 PM
How to select the first row of the current table Select Text in Table but Table Gets Selected Too RBusiness Word 1 06-07-2011 04:26 PM
How to select the first row of the current table Access to the property of the current table 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
How to select the first row of the current table Auto insert current month's name and current year Styler001 Word 4 01-25-2010 06:40 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:52 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft