+ Reply to Thread
Results 1 to 9 of 9

Excel VBA - Lookup and fetch data from word table (is it possible?)

  1. #1
    Registered User
    Join Date
    12-07-2015
    Location
    Chesterfield
    MS-Off Ver
    2013
    Posts
    24

    Excel VBA - Lookup and fetch data from word table (is it possible?)

    Hi,

    I have a spreadsheet with a set of reference numbers and details that need to be fetched from different word files.

    I then have a folder structure like this 'drive\"reference number"\document name' (The reference number is the name of the folder, this relates to the reference number in the spread sheet. The document name is within the folder named with the reference number and in all folders this document is named the same. This is a word document.)

    Within this word document there is a table with just some select details i need to get into the excel spreadsheet.

    Is this possible at all with or without VBA Scripts or any other ways you can think of? I have a feeling it is not but i am yet to have tried yet i just want to see if anyone on here knows if it is and how to do this.

    I have only ever used VBA a couple of times so please bare with me.

    Thanks.

  2. #2
    Registered User
    Join Date
    12-07-2015
    Location
    Chesterfield
    MS-Off Ver
    2013
    Posts
    24

    Re: Excel VBA - Lookup and fetch data from word table (is it possible?)

    Has anyone got any ideas?

  3. #3
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Excel VBA - Lookup and fetch data from word table (is it possible?)

    Yes, it is possible but you need to provide specifics if you want a detailed answer.

    It is simple enough to open a Word document and go to a table (but you need some way to define which table) and extract details, but again you need to give details.

    The following example will open a Word doc and copy all the details from the first table to the active worksheet
    Please Login or Register  to view this content.
    The code requires a reference set to the Word Object model as it uses early binding (Something for you to look up).

  4. #4
    Registered User
    Join Date
    12-07-2015
    Location
    Chesterfield
    MS-Off Ver
    2013
    Posts
    24

    Re: Excel VBA - Lookup and fetch data from word table (is it possible?)

    Okay,

    So here are the files. The word document and the spreadsheet. I couldn't get the macro to run without showing me an error. I really are not that experienced with VBA.

    So this is the word document - https://drive.google.com/open?id=0B4...lJwelJzX1pQQzA

    This is the spreadsheet - https://drive.google.com/open?id=0B4...0dYWTkyREotZEE

    These word documents are all kept in separate folders that are named the reference number followed by the date. Such as 105350714 so it will need to look up the folder within a directory ignoring the last 4 digits.

    Thanks.

  5. #5
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Excel VBA - Lookup and fetch data from word table (is it possible?)

    Quote Originally Posted by Harveyl12 View Post
    I couldn't get the macro to run without showing me an error
    What error?

  6. #6
    Registered User
    Join Date
    12-07-2015
    Location
    Chesterfield
    MS-Off Ver
    2013
    Posts
    24

    Re: Excel VBA - Lookup and fetch data from word table (is it possible?)

    Compile Error
    User defined type not defined.

    But i cant see where i need to define anything

  7. #7
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Excel VBA - Lookup and fetch data from word table (is it possible?)

    ... uses early binding (Something for you to look up)
    Did you do that...?

  8. #8
    Registered User
    Join Date
    12-07-2015
    Location
    Chesterfield
    MS-Off Ver
    2013
    Posts
    24

    Re: Excel VBA - Lookup and fetch data from word table (is it possible?)

    Hi,

    I will research this. Is there anything in particular i need to look at with the early bindings?
    Where is this in the code?

  9. #9
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Excel VBA - Lookup and fetch data from word table (is it possible?)

    It's not 'in code' as such but it relates to how you interact with other applications - to use 'Early Binding' you set a reference using the Tools/References menu and declare variables using syntax like
    Please Login or Register  to view this content.
    Late binding is different, you're working with generic 'objects'
    Please Login or Register  to view this content.
    You need to decide which is most appropriate for your situation, especially if the workbook is distributed to other users so you need to understand the differences and implications. Best done with a little studying. Any generic search ("vba binding late vs early") will get you all the information you need.
    Last edited by cytop; 05-19-2017 at 10:10 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Extract Word header table data to excel (closed word document)
    By Yakov on Excel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-14-2017, 02:12 PM
  2. [SOLVED] Need Macro/Formula to Fetch the data from table
    By gunjan8882 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-16-2016, 08:12 AM
  3. Fetch Data from Access table into Excelsheet
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-07-2014, 11:35 AM
  4. Replies: 3
    Last Post: 01-07-2014, 06:13 AM
  5. [SOLVED] how to fetch data from a table on check event of a checkbox in excel vba
    By basubdd in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-28-2013, 02:52 PM
  6. How to fetch the table from ASP web site and save in Excel
    By rajen87 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-05-2012, 01:47 PM
  7. Open Word and fetch specific data
    By pikapika13 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-31-2006, 04:08 PM

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