+ Reply to Thread
Results 1 to 3 of 3

Find & Open Word doc with Excel VBA

  1. #1
    Registered User
    Join Date
    01-25-2013
    Location
    Charleston, SC
    MS-Off Ver
    Excel 2010
    Posts
    25

    Find & Open Word doc with Excel VBA

    I'm using Office 2010, fwiw.

    I have a simple macro that I want to complicate. Right now it just adds 30 to a date and highlights it in yellow. I want to add one of two abilities: 1) search through several folders for a document whose name will change periodically and open it, or 2) search in 1 folder for 1 mail merge document whose name will never change and open it.

    Option 1 would be a little easier on me once it's all setup, but option 2 sounds a LOT easier to make happen. Anyway, here is my algorithm for option 1, can someone help me translate it into VBA? I've done quite a bit of googling and can't find what I need. (Note that column and row references are to the spreadsheet named One Log to Rule Them All, and the table is named OLtRTA. I would prefer references to the column header name rather than the column letter since I'm likely to add or delete columns and thus things will change).

    1. Go to G:\Families First\Cases\Region T#, where T# is OLtRTA[Region], or the column T and # is the row number the cursor is on.
    2. Search in above mentioned folder for a folder containing strings from both G# I# where G and I are OLtRTA[Family name] and OLtRTA[Child(ren)'s Names] (or column G and I) and # is the row number the cursor is on
    3. Inside that folder, search for a file containing "extensionX" where X is 10 and loops down to 2 until a result is found, then open the file.
    4. If no result is found in the above loop, search for and open the file containing the string "STF"

    If you'd rather help me tackle option 2, below is my algorithm for it:

    1. Open G:\Families First\Cases\STF-Extension.docx
    2. OPTIONAL: point the mail merge to X-1, where X is the row number the cursor is on

    Thanks for taking time to look at this. Let me know how terrible of an idea this all is

  2. #2
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Find & Open Word doc with Excel VBA

    Hi,

    I'll take a go at the easier one

    Please Login or Register  to view this content.
    Regards,
    Rudi

  3. #3
    Registered User
    Join Date
    01-25-2013
    Location
    Charleston, SC
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Find & Open Word doc with Excel VBA

    This works, but it opens STF-Extension.docx as a static document without mail merge capability. Any way for STF-Extension.docx to keep it's mail merge setup?

  4. #4
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Find & Open Word doc with Excel VBA

    Hi,

    Sorry. I didn't realise that.
    The code to set up or activate a mail merge process is a little more detailed...and something that I do not have much experience with. I did manage to track down some sample code that you can tweak or at least will give you an idea of how to open, link up with Excel and even perform a mail merge. I hope this help since it is a bit out of my depth

    See page here: http://stackoverflow.com/questions/1...-each-row-of-t

+ 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. Open Word docm from Excel: Test if already open? Word errors?
    By brucemc777 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-21-2014, 01:02 PM
  2. Check if a Word File is Open and If Open Close it with Excel VBA.
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-10-2012, 11:14 AM
  3. Macro to open word doc, then open another file in word and then excute a find replace
    By Uber-Smee in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-29-2010, 09:43 AM
  4. Replies: 2
    Last Post: 10-13-2006, 08:41 AM
  5. [SOLVED] Open word then find replace text
    By Shawn G. in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-04-2005, 09:05 AM

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