Share via


Using VBA macro, how to click or select a particular page in a word document or cursor focus need to put on desired page

Question

Monday, August 27, 2012 5:53 PM

Hi,

To select a specific page in a word document using VBA script, what is the code snippet. I tried with the below line to get count of pages. To add or edit on particular page ex: 5th page, i did not get any method to select. Thanks in advance for your help.

ActiveDocument.BuiltInDocumentProperties(14)

Thanks,

Ashok

All replies (6)

Tuesday, August 28, 2012 8:05 AM ✅Answered

Selection.GoTo wdGoToPage, wdGoToAbsolute, page-number

 

 .. will move the selection to the start of page page-number. To then select the whole page, you could use ...

 

Selection.Bookmarks("\Page").Select

 

I'm not entirley sure what you want. Of course, you should not be using the Selection unless you want the user to see it.

 

Enjoy,
Tony
www.WordArticles.com


Wednesday, August 29, 2012 5:14 PM

Hi Tony,

Thank you so much for your quick help, it is working as expected.....

Thanks,

Ashok


Wednesday, August 29, 2012 5:18 PM

Hi Tony,

I had one more problems which is already posted in forums with the below subject. If you dont mid can you please have look into the issue and please suggest if you have any solution. Thanks in advance...

'Excel is hanging or freezing while running macro with loops'

Thanks,

Ashok


Thursday, August 30, 2012 10:33 AM

I have had a quick look at that thread but have nothing I can add at the moment. It does seem a little unclear - are you trying to step through the code in the VBE, as has been asked? The concept of 'hanging' makes no real sense at a breakpoint.

 

Enjoy,
Tony
www.WordArticles.com


Thursday, August 30, 2012 6:35 PM

Hi Tony,

Thanks for the response. I mean when i run my macro from excel it is getting freezed(excel is showing as empty window) and it is not allowing us to perform any action on the opened excel books.

My macro continuously listen for key presses with a loop, due to this it is freezed.

Thanks in advance for your help....

Thanks,

Ashok


Sunday, May 4, 2014 7:38 AM

See reply to your separate thread: http://social.msdn.microsoft.com/Forums/office/en-US/999832ea-be48-4b1b-a12c-f74f2c180e41/vba?forum=worddev#e69fdcec-7350-4c4b-a225-5dce03b0603b

PS: Please don't resurrect old threads - especially when you're starting a new one on the same topic!

Cheers
Paul Edstein
[MS MVP - Word]