Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 02-26-2023, 12:31 PM
BrianHoard BrianHoard is offline Run a macro from page x to page Y Windows 10 Run a macro from page x to page Y Office 2019
Advanced Beginner
 
Join Date: Jul 2022
Location: Haymarket, VA USA
Posts: 85
BrianHoard is on a distinguished road
Default

Just a thought. What if you had the user enter a keyword where they wanted to start, and end. Then, let your script look for that to determine the range to work with? I know it may not be perfect, but I have used this sort of thing in the past as a quick way to get something done. For instance, if at the start of your desired range, the user entered some unique string like <<<FORMAT START HERE>>>, and a similar one at the end.
Some pseudo code to work with that might be...
Using a find, search for <<<FORMAT START HERE>>>.
Store the .Start of this range as a variable.

Do the same for <<<FORMAT END HERE>>>, getting the .End of that range.

Now, you have your .Start and .End stored so apply your formatting to that.
When finished, delete the formatting strings.

Just something to consider, as I am not sure there is a way to tell Word to act on pages, since the number pages can vary as you edit the document and things automatically flow from page to page.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Run a macro from page x to page Y inserting a page break after each 9th page? or skip print on the 10th page ? vender Mail Merge 2 05-27-2020 05:18 AM
Custom page size - Page color not covering entire page when converting to PDF icor1031 Word 9 12-09-2019 08:21 PM
Run a macro from page x to page Y Start page number on page 3, go to page not working properly MetroBOS Word 7 01-30-2016 11:31 PM
2 page document printing problem, text from page 1 in layout of page 2 when printed laurawether45 Word 1 08-02-2012 07:03 AM
Run a macro from page x to page Y MS Word, page goes to next page when entering data on previous page munna94 Word 2 12-30-2010 08:12 AM

Other Forums: Access Forums

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