Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
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,176
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
 

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 08:36 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