Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Aug 2001
    Posts
    158
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Current Cursor Position Macro (Word 97 SR2)

    I can't seem to find a macro command to return the current cursor position, horizontal and vertical.

    Does such command exists?

    Thanks,
    --Maria

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Current Cursor Position Macro (Word 97 SR2)

    Hi Maria:

    I'm not a VBA expert but PrevSel1 & PrevSel2 are 2 invisible bookmarks that return the cursor to the last editing spot (just like Shift+F5). If that doesn't get you started, maybe someone else could jump in.

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Current Cursor Position Macro (Word 97 SR2)

    If you are trying to get the information that normally displays in the Status Bar (Ln and Col), you can use these functions:

    intLineNumber = Selection.Information(wdFirstCharacterLineNumber)
    intColumnNumber = Selection.Information(wdFirstCharacterColumnNumber )

    If you are trying to do something more complicated, and the other Information options don't do it, please post again.

  4. #4
    2 Star Lounger
    Join Date
    Aug 2001
    Posts
    158
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Current Cursor Position Macro (Word 97 SR2)

    Oh geez, maybe I am making it too difficult for myself, LOL.

    Anyway, what I am really trying to do is to separate each section in a separate file. For example, if a certain file have more than 2 sections, I'd like save Section 1 as a different file, and Section 2 as a different file, without making any modifications or writing over the original file.

    Thanks for the help guys! I do appreciate them.

    --Maria

  5. #5
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Current Cursor Position Macro (Word 97 SR2)

    If each section starts with a heading style, you can use master document to create separate files. It's the one thing that Master Documents seems to do without corrupting files. I would then treat each file as separate & not use the Master again.

  6. #6
    Star Lounger
    Join Date
    Sep 2001
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Current Cursor Position Macro (Word 97 SR2)

    Hello Maria

    Perhaps you are looking to far. "ActiveDocument.Sections(1).Range.Select" would select the first section, "ActiveDocument.Sections(2).Range.Select" the second, ...
    If you use a for next loop, you could simply step through the sections and save them as new document.
    In fact if you only want to access the sections by code you can even drop the Select and use "ActiveDocument.Sections(1).Range" only to reference to the section.

    HTH
    hedgehog

Posting Permissions

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