Consulting

Results 1 to 4 of 4

Thread: Set Start locations (seems to now be impossible with AutoNew)

  1. #1
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,340
    Location

    Set Start locations (seems to now be impossible with AutoNew)

    What has Microsoft done to break Word? For years, I have used a simple line of code to set the start location when creating a new document.

    The
    Sub AutoNew()
      ActiveDocument.SelectContentControlsByTitle("Target").Item(1).Range.Select
      MsgBox Selection.Range.Text 'Words as the message box returns the text, in the target content control
      'But when the code completes and the document is displayed, the cursor is at the top of the page and not the range just selected!!
    End Sub
    Greg

    Visit my website: http://gregmaxey.com

  2. #2
    I am not sure that it has. I am pretty sure I have the latest build and that macro still works here as it should, leaving the selection in the content control.
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

  3. #3
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,340
    Location
    Graham,

    Strange. It is broke here with all versions of Word 2007. I can't say for sure, but it might have something to do with Windows10. Perhaps there some obscure setting somewhere. I'll have to investigate.

    Thanks.
    Greg

    Visit my website: http://gregmaxey.com

  4. #4
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,340
    Location
    I write this while picking crow feathers from my teeth. Microsoft is not to blame. The wound was self inflicted. At some point, and for some reason that I fail to recall, I had added a line to class procedure that sets view and zoom for all documents when created or opened. It was causing this behavior.

    Sorry for the false alarm.
    Greg

    Visit my website: http://gregmaxey.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •