Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > Word VBA
| Search | Today's Posts | Mark Forums Read
Word VBA Discuss using VBA to program Word.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Word VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 1st, 2010, 05:10 PM
Registered User
 
Join Date: Mar 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reposition the cursor to end of document

Hi Folks,

I am not a VBA programmer but I am using VBA with WORD 2007. I created a template/form to capture input from users. The form consists of a table from which the user inputs specific data elements, and a free format area where the user authors an assessment.

I put a macro in one of the drop down boxes in the table to execute on exit. That macro should place the cursor at the end of the document. The end of the document should be immediately following the word "Assessment:" which follows the table... When I test the macro with the template unprotected, it works as expected and places the cursor right after the word "Assessment".

However, when I protect the template and execute it .. the cursor ends up directly after the table that is above the word "Assessment:". No warnings or errors from VBA or WORD, it just dumps the cursor "early".

Any guidance you can provide would be appreciated. If you require compensation for your time and efforts please let me know your scale.

Thanks much.

Fergie
 
Old March 1st, 2010, 09:30 PM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

If the document is protected and your end of document cannot be edited, the cursor will not move there.

I am not sure about the code you have. Here is a hint if you want to move to EOD

Selection.GoTo wdGoToBookmark, , , "\EndOfDoc"

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old March 1st, 2010, 11:35 PM
Registered User
 
Join Date: Mar 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reposition cursor

I can accept your premise at face value, but as I mentioned, the cursor does move to the end of the file before I protect the document. But only to the end of the table after protecting it.

I suppose I could have the macro unprotect the file before executing the command to go to the end...

I do not fully understand your sample code. I do not have a bookmark defined for EndOfDoc. I will research on that idea though.

Thanks for the feedback.

Fergie
 
Old March 2nd, 2010, 07:32 AM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

\EndOfDoc is a predefined bookmark in Word. This resides at the End of the document

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old March 4th, 2010, 12:13 AM
Registered User
 
Join Date: Mar 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default EndOfDoc

Roger that... Thank you!

Ferg




Similar Threads
Thread Thread Starter Forum Replies Last Post
Put cursor at the end of input text peace2007 Javascript 1 October 11th, 2007 04:49 AM
Finding End of Document Larry Landis Word VBA 1 September 11th, 2007 11:31 PM
Can we reposition the columns o listview-VB.NET pauljoy Pro VB 6 0 January 10th, 2006 01:43 AM
DataGrid reposition sparc Classic ASP Databases 0 August 4th, 2005 06:53 AM
VB Data Control - Reposition does not fire georg Pro VB 6 2 September 8th, 2003 07:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.