Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-13-2022, 12:21 PM
data808 data808 is offline Protected Word Document Open Cursor Location Windows 10 Protected Word Document Open Cursor Location Office 2019
Novice
Protected Word Document Open Cursor Location
 
Join Date: Oct 2022
Posts: 16
data808 is on a distinguished road
Default Protected Word Document Open Cursor Location


I have a word document that is protected and is set on "No changes (Read only)" and so this causes the cursor to be in the top left of the document when I open the file. Is there a way to make it so that the cursor's focus is on a specific date picker in the document? I locked the structure of this document except for the date pickers, content control text boxes (plain text), etc... I had to do this because of content control checkboxes weren't very smooth when tabbing through the fillable areas of the document. I also tried legacy checkboxes with not much luck either so this No Changes (Read Only) has been working fine. Now I just want the cursor to be on a date picker in the top center of the document because that is the first fillable area that the user will start typing in data. Please help. Thanks in advanace.
Reply With Quote
  #2  
Old 10-13-2022, 02:24 PM
macropod's Avatar
macropod macropod is offline Protected Word Document Open Cursor Location Windows 10 Protected Word Document Open Cursor Location Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by data808 View Post
I have a word document that is protected and is set on "No changes (Read only)" and so this causes the cursor to be in the top left of the document when I open the file. Is there a way to make it so that the cursor's focus is on a specific date picker in the document?
That behaviour is by design. indeed, all Word documents open that way. The only available workaround would be to use a macro to select another range upon the document being opened.

Quote:
Originally Posted by data808 View Post
I locked the structure of this document except for the date pickers, content control text boxes (plain text), etc... I had to do this because of content control checkboxes weren't very smooth when tabbing through the fillable areas of the document. I also tried legacy checkboxes with not much luck either so this No Changes (Read Only) has been working fine.
Please note that formfields and content controls should not be used in the same document. They weren't designed to be used that way and trying to do so is a known source of problems - especially when checkboxes are involved.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 10-13-2022, 04:15 PM
data808 data808 is offline Protected Word Document Open Cursor Location Windows 10 Protected Word Document Open Cursor Location Office 2019
Novice
Protected Word Document Open Cursor Location
 
Join Date: Oct 2022
Posts: 16
data808 is on a distinguished road
Default Question

Thanks. Not sure what formfields are but I think all the controls I have in my document were selected from what shows on the ribbon at the top of the window and those items all seem to say content controls when I hover my mouse cursor over them. I read that legacy controls were inside the toolbox icon and I haven't used any of those. So pretty sure all of the text boxes and date pickers are from the content control section.

Would you be able to give me the VBA to select the date picker content control? I tried this on the open event of the document and it doesn't seem to work. Btw, I named the date picker title and tag "test":

ActiveDocument.SelectContentControlByTag (test)

Also tried:

ActiveDocument.SelectContentControlByTitle (test)

Not sure what I am doing wrong.
Reply With Quote
  #4  
Old 10-13-2022, 05:29 PM
Guessed's Avatar
Guessed Guessed is offline Protected Word Document Open Cursor Location Windows 10 Protected Word Document Open Cursor Location Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,991
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

If the file protection type is 'Filling in forms' then the first content control in the document will be automatically selected when you open the document.

If the file protection is 'No changes (Read only)' then there seems to be no point in selecting anything. Reading doesn't need a selection.

If you do still want to select something specific as the file is opened then you are relying on the whim's of the system/user in enabling macros. If you wanted to go down this path you can put a macro like this into your ThisDocument module
Code:
Private Sub Document_Open()
  Dim aCC As ContentControl
  On Error Resume Next
  Set aCC = ActiveDocument.SelectContentControlsByTitle("MyDate")(1)
  aCC.Range.Select
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #5  
Old 10-13-2022, 06:09 PM
data808 data808 is offline Protected Word Document Open Cursor Location Windows 10 Protected Word Document Open Cursor Location Office 2019
Novice
Protected Word Document Open Cursor Location
 
Join Date: Oct 2022
Posts: 16
data808 is on a distinguished road
Default

Thank you so much. I can't believe you need to add Dim statements just for something so simple. I worked with excel spreadsheets and usually its a lot more simple when it comes to selecting a cell.

In most cases yes, No Change (Read Only) wouldn't have a point to selecting anything but I had to go this route because of how the checkboxes work with tabbing. I am using the content control checkboxes and they do not work well when your document is locked and you want to tab through all the fillable areas of the document. So I selected No Change and made exceptions instead but then of course the document opens in read-only mode and has the cursor at the top left which makes sense but not for my situation.

Thank you so much for the help. Really appreciate it.
Reply With Quote
  #6  
Old 10-13-2022, 11:49 PM
macropod's Avatar
macropod macropod is offline Protected Word Document Open Cursor Location Windows 10 Protected Word Document Open Cursor Location Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by data808 View Post
Not sure what formfields are but I think all the controls I have in my document were selected from what shows on the ribbon at the top of the window and those items all seem to say content controls when I hover my mouse cursor over them.
I posted that comment because you said:
Quote:
I also tried legacy checkboxes
Those would have to be either formfields or ActiveX controls.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 10-13-2022, 11:53 PM
macropod's Avatar
macropod macropod is offline Protected Word Document Open Cursor Location Windows 10 Protected Word Document Open Cursor Location Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by data808 View Post
Thank you so much. I can't believe you need to add Dim statements just for something so simple.
You don't:
Code:
Private Sub Document_Open()
ActiveDocument.SelectContentControlsByTitle("MyDate")(1).Range.Select
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #8  
Old 10-14-2022, 12:01 AM
Guessed's Avatar
Guessed Guessed is offline Protected Word Document Open Cursor Location Windows 10 Protected Word Document Open Cursor Location Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,991
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

As Paul has shown, the macro can be a single line of code. I included the extra lines to try to avoid possible errors should the object not exist or perhaps not be selectable.

Coding in Excel can also be written in few lines if you are happy to deal with errors when something unforeseen causes a problem.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #9  
Old 10-14-2022, 01:03 AM
data808 data808 is offline Protected Word Document Open Cursor Location Windows 10 Protected Word Document Open Cursor Location Office 2019
Novice
Protected Word Document Open Cursor Location
 
Join Date: Oct 2022
Posts: 16
data808 is on a distinguished road
Default

Thanks for the help people. You guys have taught me a lot and thanks for showing me different ways to approach my issue with the document.
Reply With Quote
  #10  
Old 10-14-2022, 01:06 AM
data808 data808 is offline Protected Word Document Open Cursor Location Windows 10 Protected Word Document Open Cursor Location Office 2019
Novice
Protected Word Document Open Cursor Location
 
Join Date: Oct 2022
Posts: 16
data808 is on a distinguished road
Default

This seems to be what I was looking for but @Guessed had a good point of trying to prevent unforeseen errors from occurring. Thank you for the help.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Protected Word Document Open Cursor Location How to control INPUT CURSOR location when clicking in Word after being in another app? Retko Word 1 04-11-2019 09:34 PM
Protected Word Document Open Cursor Location Cursor location on first click -- insertion point stevec5088 Word 1 12-14-2016 02:45 PM
Protected Word Document Open Cursor Location Hightlight cells based on cursor location megads Excel Programming 2 07-31-2014 06:10 PM
Protected Word Document Open Cursor Location Open document file location issue help required jborchel Word 8 10-21-2013 02:58 PM
How to open a password-protected word document? navalava Word 1 07-01-2012 12:15 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:22 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft