Results 1 to 7 of 7
  1. #1
    Star Lounger
    Join Date
    Sep 2002
    Location
    Melbourne, Victoria, Australia
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How do I copy from cursor to next section break? (Word 2003 (11.6359.6360) SP1)

    I'm using Dragon Naturally Speaking, and I am creating a macro (recording my actions from within DNS).

    I have two documents loaded.

    The first doc is based on a template with many autotext entries and is in .doc format.
    This doc is divided into 32 individual sections (a single letter will be typed in each section, with it's own continuing header should letter run over one page).
    The second doc is a listing of patient details and is in .rtf format.

    I can work out the DNS side of things.

    I need to know if keyboard shortcut/s exist in Word 2003 that will allow me to do the following.



    Can I turn Copy on in Word using a keyboard shortcut?
    Can I then instruct Word to copy everything from position of the cursor position up to but not including the next section break.

    The details I will be "copying" vary in the second document, which is why I am using the Section Break as a placemark to capture everything I need.

    If I can perform the above, I will then be able to record these actions into my Dragon Command, and will be able to use it over and over.

    If anyone knows how I can do this "live", i.e. using keyboard shortcuts, not visual basic codes, I'd be ever so grateful.

    Thanks so much.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How do I copy from cursor to next section break? (Word 2003 (11.6359.6

    You could create a macro in your Normal.dot and assign it a keyboard shortcut:

    Sub Copy2Section()
    Selection.Extend
    Selection.GoTo What:=wdGoToSection, Which:=wdGoToNext
    Selection.Find.ClearFormatting
    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    Selection.Copy
    End Sub

  3. #3
    Star Lounger
    Join Date
    Sep 2002
    Location
    Melbourne, Victoria, Australia
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How do I copy from cursor to next section brea

    Hello Hans,

    Thank you so much for your reply and the helpful macro text you supplied.

    I have copied this into VBA editor and will assign a shortcut key.

    Just for interest's sake, if I wanted to change part of this macro, i.e. say I wanted to copy down to but not including the next occurrence of text, i.e. FILE NO:, could I easily tweak the macro you have supplied by replacing the "Section" with other choices, i.e. FILE NO:

    As you can probably tell, I'm not at all versed in VBA but I can just get around if I have very, very simple steps. Really, I'm only just able to copy macro text into VBA, and create a keyboard shortcut for it. That's pretty much all I'm able to understand about it at this point and I'm very, very busy with work so do not have time to immerse myself just at the moment (though I wish I did) in learning more about it.

    I look forward to your thoughts about changing the macro from Copy from cursor position to next "Section Break" to Copy from cursor position to next occurrence of text FILE NO:

    Again, many thanks for your help with this. I hope to learn more about VBA as soon as time permits (hopefully one day soon!).

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How do I copy from cursor to next section brea

    It's not quite that simple. The GoTo method lets you go to specific elements of a document, such as a page, section, bookmark etc. It is the VBA equivalent of Edit | Go To...
    To find text, you need the Find method; this is the VBA equivalent of Edit | Find...

    You could use this macro. It will prompt you to enter the text up to which you want to copy:

    Sub CopyUp2Text()
    Dim strText As String
    strText = InputBox("Enter the text to find")
    If strText = "" Then
    Beep
    Exit Sub
    End If
    Selection.Extend
    If Selection.Find.Execute(FindText:=strText) = True Then
    Selection.Copy
    Else
    MsgBox "Text not found.", vbExclamation
    End If
    End Sub

  5. #5
    Star Lounger
    Join Date
    Oct 2006
    Location
    Albany, New York, USA
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How do I copy from cursor to next section break? (Word 2003 (11.6359.6

    Hi Ozgal,

    Have you tried useing Shift+down arrow to select the text, and then use Ctrl+C to copy and Ctrl+ V to paste. This works in Word 03 for recording a macro.

  6. #6
    Star Lounger
    Join Date
    Sep 2002
    Location
    Melbourne, Victoria, Australia
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How do I copy from cursor to next section brea

    Hi again Hans,

    Sorry it's taken me a while to get back to say thank you.

    I've created a macro using the second VBA Code you kindly provided.

    This is working like a charm and exactly what I was after.

    Thank you so much - your help is really appreciated.

  7. #7
    Star Lounger
    Join Date
    Sep 2002
    Location
    Melbourne, Victoria, Australia
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How do I copy from cursor to next section brea

    Hello Ed,

    Thank you for your help with this. Yes, I am aware that I can use Shift+down arrow to select the text, and then Ctrl+C to copy and Ctrl+ V to paste, and that this works in Word 03 for recording a macro.

    The only problem in this particular instance is that the data I'm copying into my main document varies in length. The data could be one line of text, or 5, 10 or more lines of text. Hence my need for a macro that allows copying of text from the cursor position to a particular "location or text string" in the data document.

    With Hans' macro my search string is a single underscore i.e. _

    This copies all the data in between cursor position and the underscore. If I used Shift+down arrow the macro would have no way of knowing how many lines of data I wanted to copy.

    **The following shows how the data appears in the document I'm collecting it from. (Note also that I may need to copy data numerous times for insertion into the main document). I just use Hans' macro every time I need to do this, i.e.

    In the Data Document the Cursor is positioned here <font color=ff8c00> X
    c.c. Mr X, Address details,
    c.c. Mrs X, Address details
    c.c. Miss X, Address details
    c.c. Master X, Address details
    c.c. Ms X, Address details
    _</font color=ff8c00>

    I am therefore able to collect data with varying lines of text using the one macro (i.e. Hans' macro) each time, as per orange sample above, and the green sample below:

    In the Data Document the Cursor is positioned here <font color=008080>X
    c.c. Mr X1, Address details,
    c.c. Mrs X1, Address details
    _

    </font color=008080>

    Hope this explains my need for the macro Hans has kindly supplied the VBA code for.

Posting Permissions

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