+ Reply to Thread
Results 1 to 4 of 4

Pasting Excel data into Word at current cursor position

  1. #1
    Registered User
    Join Date
    06-22-2009
    Location
    Munich, Germany
    MS-Off Ver
    Excel 2003
    Posts
    3

    Pasting Excel data into Word at current cursor position

    Hello,

    I am trying to write an Excel vba script which pastes data into a word document. I have already made a great deal of progress by searching this and other forums, but now I seem to be stuck. Maybe one of you can help me out.

    Here's how one should be able to use the script:
    The user has multiple Excel documents available [which all contain this macro, as they were generated from the same template by a third-party software (LabView)].
    The user is already working on a Word document, typing text until he decides that he wants to add some information from one of the Excel sheets. To do this, he changes to Excel, clicks on the button running the script, and the required information is pasted into the Word document at the present cursor position.

    Here's what I got so far:
    Please Login or Register  to view this content.
    It works fine except that it always inserts the data right at the beginning of the Word document, which is not a big surprise because I have told the script to do so by specifiying range(0,1):
    Please Login or Register  to view this content.
    Now how can I find out the current cursor position in the Word document? After doing some research in the Word VBA forums, I tried to use something along the line of
    Please Login or Register  to view this content.
    but the Excel VBA script always shows an error message ("Does not support this property or method"). Do you know how to do this?

    Thanks in advance,
    gonefishing
    Last edited by gonefishing; 06-23-2009 at 08:59 AM. Reason: added solved prefix

  2. #2
    Registered User
    Join Date
    06-22-2009
    Location
    Munich, Germany
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Pasting Excel data into Word at current cursor position

    No answers yet - is the question too simple or too tricky?

    Anyway, in the meanwhile I found out how to paste at the end of the document, which is already a lot more useful:

    Please Login or Register  to view this content.
    But still it would be much more convenient if I could just paste at the current cursor position, and I would be glad for any help...

  3. #3
    Registered User
    Join Date
    06-22-2009
    Location
    Munich, Germany
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Pasting Excel data into Word at current cursor position

    I have solved the problem myself now.

    This command does the trick:
    Please Login or Register  to view this content.
    And this is the whole script, which works now, for the record:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    10-15-2013
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Pasting Excel data into Word at current cursor position

    Thank you for posting the final solution, this has been very helpful!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1