Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-28-2021, 02:36 PM
Guessed's Avatar
Guessed Guessed is offline Need Help to Script to align all the tables only as of a section to end of doc? Windows 10 Need Help to Script to align all the tables only as of a section to end of doc? Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,185
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Cendrinne



Think about VBA commands as basically a roadmap, zooming in to lower levels as you go. It is similar to saying Earth.Canada.Quebec.Montreal - each steps gives greater resolution. We can't just say Montreal because there are Montreal streets in cities all over the world.

Each vba command is part of a chain that provides context for the next command. Sections(1) tells you something but without the context preceding it we can only guess which Section was intended.

ActiveDocument.Sections(2).Paragraph(3) would be saying -> think of the active document, now in that document think of the second section, now in that section think of the third paragraph

Selection.Range.Sections(1).Range.Start is saying -> go to the current selection, then convert it into a range object, then look at the entire section where that range starts, then convert that section into a range, then tell me the position where that range starts. So all of that is just to work out a position which I then use to define the start of a range.

Code:
ActiveDocument.Range(Selection.Range.Sections(1).Range.Start, ActiveDocument.Range.End)
is saying
Go to the active document and then in that document think of a range that starts with the a position (as described in above paragraph) and ends at the end of the document.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #2  
Old 04-05-2021, 11:37 AM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Need Help to Script to align all the tables only as of a section to end of doc? Windows 10 Need Help to Script to align all the tables only as of a section to end of doc? Office 2019
Competent Performer
Need Help to Script to align all the tables only as of a section to end of doc?
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 200
Cendrinne is on a distinguished road
Default I had to rearead it twice, but I think I get it :)

Wow, I think I'm getting what you are saying, Andrew.

Thank you, you succeeded to explain it in a way I would comprehend this stuff.

I thank you beyond words can express 😊

Cendrinne
Reply With Quote
Reply

Tags
align tables in section, help please



Similar Threads
Thread Thread Starter Forum Replies Last Post
Something in header with text boxes won't let a section align vertically - sometimes ryannah05 Word 5 04-10-2020 09:48 AM
Need Help to Script to align all the tables only as of a section to end of doc? vba script to align text to the center olybobo Excel Programming 1 05-26-2016 01:09 AM
Script starts nesting tables without reason selman555 Word VBA 1 10-17-2014 01:01 AM
Need Help to Script to align all the tables only as of a section to end of doc? How to format and align multiple tables in a document in bulk? Joey Cheung Word Tables 1 08-08-2014 11:34 PM
Need Help to Script to align all the tables only as of a section to end of doc? How to right align section numbers in TOC? Dr Wu Word 1 01-03-2014 02:07 PM

Other Forums: Access Forums

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