Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-20-2024, 11:49 AM
DavidPaul DavidPaul is offline Column padding not taking Windows 11 Column padding not taking Office 2013
Novice
Column padding not taking
 
Join Date: Oct 2023
Posts: 9
DavidPaul is on a distinguished road
Default Column padding not taking


I have a macro that resizes all column of a certain colour, which includes this code:
Code:
thisCol.LeftPadding = CentimetersToPoints(0.1)
thisCol.RightPadding = CentimetersToPoints(0.1)
However, if I manually drag-and-widen a column, then run the macro, it doesn't work. The padding remains unchanged. Any ideas?
Reply With Quote
  #2  
Old 12-20-2024, 04:52 PM
Italophile Italophile is offline Column padding not taking Windows 11 Column padding not taking Office 2021
Expert
 
Join Date: Mar 2022
Posts: 554
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

Probably because Column does not have a LeftPadding or RightPadding property. You’ll need to loop through the Cells collection of the column.
Reply With Quote
  #3  
Old 12-20-2024, 05:00 PM
DavidPaul DavidPaul is offline Column padding not taking Windows 11 Column padding not taking Office 2013
Novice
Column padding not taking
 
Join Date: Oct 2023
Posts: 9
DavidPaul is on a distinguished road
Default

Quote:
Originally Posted by Italophile View Post
Probably because Column does not have a LeftPadding or RightPadding property. You’ll need to loop through the Cells collection of the column.
Apologies, I put the wrong code in. It should have been:
Code:
thisTable.LeftPadding = CentimetersToPoints(0.1)
thisTable.RightPadding = CentimetersToPoints(0.1)
...which I presumed would ripple down to the cell level. Is that not so?
Reply With Quote
  #4  
Old 12-20-2024, 09:25 PM
macropod's Avatar
macropod macropod is offline Column padding not taking Windows 10 Column padding not taking Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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

Assuming thisTable points to the correct table, your latest code works for me.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 12-21-2024, 01:12 AM
DavidPaul DavidPaul is offline Column padding not taking Windows 11 Column padding not taking Office 2013
Novice
Column padding not taking
 
Join Date: Oct 2023
Posts: 9
DavidPaul is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Assuming thisTable points to the correct table, your latest code works for me.
Yes, it works for me, too. But it doesn't if I drag-and-widen a column first.
Reply With Quote
  #6  
Old 12-21-2024, 02:39 AM
macropod's Avatar
macropod macropod is offline Column padding not taking Windows 10 Column padding not taking Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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 DavidPaul View Post
Yes, it works for me, too. But it doesn't if I drag-and-widen a column first.
Which is exactly what I did before running a macro with your code in it - and it worked.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 12-21-2024, 02:59 AM
DavidPaul DavidPaul is offline Column padding not taking Windows 11 Column padding not taking Office 2013
Novice
Column padding not taking
 
Join Date: Oct 2023
Posts: 9
DavidPaul is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Which is exactly what I did before running a macro with your code in it - and it worked.
Ah, I see, it works for you even if you drag-and-widen the column before running the macro. Curious.

I'm afraid I'm stumped. I guess I'll have to loop through the cells and do it that way.

Thanks for your help.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Tables in All Headers in Every Section - Remove cell's padding Cendrinne Word VBA 6 03-06-2022 04:26 AM
Column padding not taking Macro to change each individual cell to 0 padding, one at a time in a table with merged cells. Wild Bee Word VBA 3 02-10-2021 12:44 AM
Padding/Spacing above and below images mwilburn01 Word 3 10-17-2019 08:51 PM
Reduce Pie Chart Padding Rabscuttle PowerPoint 0 07-05-2012 11:05 AM
Column padding not taking My word files Padding This is the content! aryunis Word 3 01-13-2012 04:25 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:14 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