![]() |
|
|
Thread Tools | Display Modes |
#1
|
||||
|
||||
![]()
Hello Pros,
Again, I'm stuck on this script I found on the web, I've just modified it to my needs. It Works, BUT, it has No Dim, so being on Option Explicit, doesn't work. If I remove ''Option Explicit'', it's slow for a few tables on a couple of pages as a test, yet it checks every cell, so normal it's slow, but it does Work. I'm trying to fix the macro to have Option Explicit, along with Dim, etc. Reason, because all my scripts are for Option Explicit. Whatever I try, it either does Nothing, or I get an error message. I hate to give up, so PLEASE, could you help me. Cause on tables in a word document, people don't open the screen big enough, and they assume, a 0.75 pt, could be a 0.50 pt, so on same line or row, I see both borders. It's very long when you have to verify over 50 tables in a document to fix them. On that same web page, someone created a macro with Dim, but it add's borders from the enum (-6 to -1), from these data: WdBorderType Enum (Microsoft.Office.Interop.Word) | Microsoft Docs Code:
Sub FixCellBorders() 'Found on Web https://wordribbon.tips.net/T013081_Setting_a_Default_Table_Border_Width On Error Resume Next ' Work through all tables in document For Each objTable In ActiveDocument.Tables ' Work through all cells in each table For Each objCell In objTable.Range.Cells ' Work through all borders in each cell For Each objBorder In objCell.Borders ' Check if line weight is less than 1.00 pt If objBorder.LineWidth = wdLineWidth050pt _ Or objBorder.LineWidth = wdLineWidth075pt Then ' too thin, change it objBorder.LineWidth = wdLineWidth100pt End If Next objBorder Next objCell Next objTable End Sub ![]() Cendrinne |
Tags |
helpme, if command, wdlinewidth |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
cell border lineweights | bkcell | Excel | 0 | 08-20-2017 09:55 AM |
Can I type over a cell with a border? | Juju37 | Excel | 0 | 01-20-2015 07:40 AM |
![]() |
msbytes | Word | 4 | 08-15-2011 09:21 AM |
![]() |
markg2 | Excel | 10 | 04-12-2011 05:05 PM |
![]() |
markg2 | Word Tables | 2 | 01-15-2010 05:22 PM |