+ Reply to Thread
Results 1 to 20 of 20

macro to copy word data to excel - is it possible?

  1. #1
    Forum Contributor
    Join Date
    03-04-2008
    MS-Off Ver
    Office 2007/2010
    Posts
    127

    macro to copy word data to excel - is it possible?

    Hi there,

    I need a little help, I a word document with near enough the same text as a excel document, so i was wondering if there is anyway to copy from word to excel maybe by a macro?

    Here is the document link examples

    http://i592.photobucket.com/albums/t...ps64871a67.jpg

    http://i592.photobucket.com/albums/t...ps20f04739.jpg



    Thanks!

    K

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: macro to copy word data to excel - is it possible?

    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  3. #3
    Forum Contributor
    Join Date
    03-04-2008
    MS-Off Ver
    Office 2007/2010
    Posts
    127

    Re: macro to copy word data to excel - is it possible?

    Sorry the second link is wrong it should be this -
    http://i592.photobucket.com/albums/t...ps4ad4c479.jpg

    I tried this code -
    Please Login or Register  to view this content.

    and its coming up with - Sub or function not defined error

    Thanks!
    Last edited by Cutter; 10-17-2012 at 07:56 PM. Reason: Added code tags

  4. #4
    Forum Contributor
    Join Date
    03-04-2008
    MS-Off Ver
    Office 2007/2010
    Posts
    127

    Re: macro to copy word data to excel - is it possible?

    Any advice on this anyone?

  5. #5
    Forum Contributor
    Join Date
    03-04-2008
    MS-Off Ver
    Office 2007/2010
    Posts
    127

    Re: macro to copy word data to excel - is it possible?

    Please help?

  6. #6
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: macro to copy word data to excel - is it possible?

    insert in your profile the Excel version

  7. #7
    Forum Contributor
    Join Date
    03-04-2008
    MS-Off Ver
    Office 2007/2010
    Posts
    127

    Re: macro to copy word data to excel - is it possible?

    Thanks I have updated it

  8. #8
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: macro to copy word data to excel - is it possible?

    maybe you have to activate some Library about word, make a search

  9. #9
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: macro to copy word data to excel - is it possible?

    The code to do as you ask is a whole lot more complicated than what's been offered so far. The following macro extracts whatever's in the same paragraph as whatever your Excel heading corresponds with. However, there is some inconsistency between your Excel workbook's headings and the corresponding Word data. For example, Excel has 'Quote Number' but Word has 'Quote No', so the Quote # data won't be found!

    As for row 2 on your Excel workbook, I have no way of knowing whether that's to be extracted somehow, or is already there.

    The other thing is there's no way to tell from the document image you posted what separates the data from the paragraph headings, apart from the '-'. As coded, the macro assumes nothing more than spaces. If there's anything else, some code changes will be required.

    The macro has its own browser, so all you need to do is to point it to the target folder. The last thing to be aware of is that the macro hasn't been coded for niceties like document protection or macro content of their own.

    Please Login or Register  to view this content.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  10. #10
    Forum Contributor
    Join Date
    03-04-2008
    MS-Off Ver
    Office 2007/2010
    Posts
    127

    Re: macro to copy word data to excel - is it possible?

    Thanks for your help! i changed a few bits and run that macro but its coming up with - User-defined type not defined. It has highlighted the "Dim WkSht As Worksheet" bit

  11. #11
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: macro to copy word data to excel - is it possible?

    What application are you running the macro from? It's designed to be run from the Excel workbook and assumes the output goes to the sheet named 'Sheet1'.

  12. #12
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: macro to copy word data to excel - is it possible?

    Quote Originally Posted by macropod View Post
    The code to do as you ask is a whole lot more complicated than what's been offered so far.
    The offered code works on excel 2010, I tested before posting.

  13. #13
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: macro to copy word data to excel - is it possible?

    Quote Originally Posted by patel45 View Post
    The offered code works on excel 2010, I tested before posting.
    That may be so, but merely dumping the Word file's contents into Excel is not what the OP is asking for. Compare the layouts:
    http://i592.photobucket.com/albums/t...ps64871a67.jpg
    http://i592.photobucket.com/albums/t...ps4ad4c479.jpg
    The changed requirement was specified in post #3. Simply telling the OP to 'insert in your profile the Excel version' and that 'maybe you have to activate some Library about word, make a search' isn't really going to progress anything in that regard.

  14. #14
    Forum Contributor
    Join Date
    03-04-2008
    MS-Off Ver
    Office 2007/2010
    Posts
    127

    Re: macro to copy word data to excel - is it possible?

    I tried it in excel and changed the sheet name and it works! thanks alot, much appreciated! Only small thing is that is copies from word fine but pastes to excel around 20 rows down, so there is a huge gap, any way of getting it to paste higher up?

    Thanks again

  15. #15
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: macro to copy word data to excel - is it possible?

    That suggests your worksheet had some used, but empty rows before you ran the macro. The macro is designed to find the last-used row and start inserting data after that. This allows it to be run again without the new data over-witing what's already there.

  16. #16
    Forum Contributor
    Join Date
    03-04-2008
    MS-Off Ver
    Office 2007/2010
    Posts
    127

    Re: macro to copy word data to excel - is it possible?

    Yes I resaved it and ran it again and it works fine! Thanks so much! I owe you a nice cold Australian beverage!

  17. #17
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: macro to copy word data to excel - is it possible?

    @ isolation123

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as an infrequent user of the forum, you may have forgotten (or may not be aware) that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  18. #18
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: macro to copy word data to excel - is it possible?

    Cross-posted at: http://social.technet.microsoft.com/...a-9b16bc6a57ed
    For cross-posting etiquette, please Forum RULE 8

  19. #19
    Registered User
    Join Date
    02-20-2018
    Location
    Bogota, Colombia
    MS-Off Ver
    2016
    Posts
    1

    Re: macro to copy word data to excel - is it possible?

    Hello! I am new to coding using macro/vba, and I'm trying to use this solution. However I'm getting an "error 429-can't create object". I'm using excel 2016 for Macintosh, and haven't been able to solve it by changing the code by adding the file path after the GetFolder, and/or changing the BrowseForFolder. However, that's where it points out to when I debug it.
    GetFolder = ""
    Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
    If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path

    Thank you!

  20. #20
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: macro to copy word data to excel - is it possible?

    The code in post #9 is for the Windows platform only; it will not work on the Mac OS. You would have to at least replace both the folder selection code and the folder looping code with whatever is applicable to Macs.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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