Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-09-2022, 03:44 PM
macropod's Avatar
macropod macropod is offline Help with a script for IF with Cell Border LineWidth less than X, then put Y Windows 10 Help with a script for IF with Cell Border LineWidth less than X, then put Y Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,363
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

Try:
Code:
Sub FixTableBorders()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim Tbl As Table, Bdr As Border
With ActiveDocument
  For Each Tbl In .Tables
    With Tbl
      For Each Bdr In .Borders
        With Bdr
          If .LineStyle = wdLineStyleSingle Then
            Select Case .LineWidth
              'Case 2 To 6: .LineWidth = 8
              Case wdLineWidth025pt, wdLineWidth050pt, wdLineWidth075pt: .LineWidth = wdLineWidth100pt
            End Select
          End If
        End With
      Next
    End With
  Next
End With
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub

__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 09-10-2022, 12:14 AM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Help with a script for IF with Cell Border LineWidth less than X, then put Y Windows 10 Help with a script for IF with Cell Border LineWidth less than X, then put Y Office 2019
Competent Performer
Help with a script for IF with Cell Border LineWidth less than X, then put Y
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 200
Cendrinne is on a distinguished road
Default I've tried it, No, on my side it doesn't work :(

Quote:
Originally Posted by macropod View Post
Try:
Code:
Sub FixTableBorders()
...
End Sub
Hi there,
I've tried to see if I could fix it, but I can't. I've tried also, is to remove ' before the Case 2 To 6: LineWidth = 8, so with the ' or without the ', It doesn't do anything.

I've tested on a table that had some 075pt, and modified on the same row, by changing 075 for 050pt just on 1 cell, on a few rows.

I feel it's closer to the solution. I'll try different things, but if you do, please let me know. Thank you soooooo much for trying to help me. I'm deeply appreciative.

Cendrinne
Reply With Quote
  #3  
Old 09-10-2022, 02:52 PM
macropod's Avatar
macropod macropod is offline Help with a script for IF with Cell Border LineWidth less than X, then put Y Windows 10 Help with a script for IF with Cell Border LineWidth less than X, then put Y Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,363
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

Quote:
Originally Posted by Cendrinne View Post
Hi there,
I've tried to see if I could fix it, but I can't. I've tried also, is to remove ' before the Case 2 To 6: LineWidth = 8, so with the ' or without the ', It doesn't do anything.
The line:
Case 2 To 6: LineWidth = 8
does exactly the same thing as:
Case wdLineWidth025pt, wdLineWidth050pt, wdLineWidth075pt: .LineWidth = wdLineWidth100pt
Try:
Code:
Sub FixTableBorders()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim Tbl As Table, Bdr As Border, Cll As Cell
With ActiveDocument
  For Each Tbl In .Tables
    For Each Cll In Tbl.Range.Cells
      For Each Bdr In Cll.Borders
        With Bdr
          If .LineStyle = wdLineStyleSingle Then
            Select Case .LineWidth
              Case wdLineWidth025pt, wdLineWidth050pt, wdLineWidth075pt: .LineWidth = wdLineWidth100pt
            End Select
          End If
        End With
      Next
    Next
  Next
End With
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 09-10-2022, 03:29 PM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Help with a script for IF with Cell Border LineWidth less than X, then put Y Windows 10 Help with a script for IF with Cell Border LineWidth less than X, then put Y Office 2019
Competent Performer
Help with a script for IF with Cell Border LineWidth less than X, then put Y
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 200
Cendrinne is on a distinguished road
Default Dahhhhh, so true. Wow, I must be tired, makes perfect sens.

Quote:
Originally Posted by macropod View Post
The line:
Case 2 To 6: LineWidth = 8
does exactly the same thing as:
Case wdLineWidth025pt, wdLineWidth050pt, wdLineWidth075pt: .LineWidth = wdLineWidth100pt
You are so right. It's redundant.

OK let me try the above modified script. I'm thinking maybe it's because my operating system is in French, which I have not control on that. Believe me, I've tried many time to request an English operating system.

Thank god I truly LOVE my job.

Ok enough bla bla, let me test this. Crossing fingers.
Reply With Quote
  #5  
Old 09-10-2022, 03:39 PM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Help with a script for IF with Cell Border LineWidth less than X, then put Y Windows 10 Help with a script for IF with Cell Border LineWidth less than X, then put Y Office 2019
Competent Performer
Help with a script for IF with Cell Border LineWidth less than X, then put Y
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 200
Cendrinne is on a distinguished road
Smile

I was crossing my fingers, hoping for the best. ==> WOW, Thank you!

I'm beyond words. I have tears in my eyes, so grateful. Was spending so much time fixing other people's documents when you have more than 25, it gets sooooo long.

I'm so grateful to you. I will not forget you and your forum.

I owe you. If there is a paying format to request help, please please let me know. I wish I could send you a private message, which I can't to you. But I feel I should pay something to you or have a subscription of some sort, I would pay (as long it's reasonable).


p.s. I've look through the forum for any option to give a donation. I found it, but it's stuck on $5.00 so regardless what amount I chose, which I would give you more then $20, it goes to $5.00. So I'm just letting you know.
Reply With Quote
Reply

Tags
helpme, if command, wdlinewidth



Similar Threads
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
Help with a script for IF with Cell Border LineWidth less than X, then put Y Need to remove a line that isn't a cell border msbytes Word 4 08-15-2011 09:21 AM
Help with a script for IF with Cell Border LineWidth less than X, then put Y Cell border markg2 Excel 10 04-12-2011 05:05 PM
Help with a script for IF with Cell Border LineWidth less than X, then put Y Table cell border markg2 Word Tables 2 01-15-2010 05:22 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:07 PM.


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