Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > Word VBA
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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
Reply With Quote
  #2 (permalink)  
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)
Reply With Quote
  #3 (permalink)  
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
Reply With Quote
  #4 (permalink)  
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)
Reply With Quote
  #5 (permalink)  
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:59 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.