+ Reply to Thread
Results 1 to 8 of 8

Macro opens word doc, want file path referenced from spreadsheet

  1. #1
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    452

    Macro opens word doc, want file path referenced from spreadsheet

    I have this macro (I only posted the sections that contain a file path) that will open and modify a word document. I would like to have the file path inserted in into the spreadsheet, the sheet Admin Sheet cell A2. The purpose is so that I can give it to someone else and they can insert the file path for their own word doc and not have to actually go into the macro code to change it.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  2. #2
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Macro opens word doc, want file path referenced from spreadsheet

    Totally untested as I don't have your full code or your spreadsheet but give this a go

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    Happy with my advice? Click on the * reputation button below

  3. #3
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Macro opens word doc, want file path referenced from spreadsheet

    It didn't work. This macro would be executed from a different sheet than the "Admin Sheet" where the file path is, does the macro need that mentioned?

    Please Login or Register  to view this content.
    With this line of code, if the user decides to name their word document something other than journal, wouldn't it fail to function for them?

  4. #4
    Forum Contributor
    Join Date
    05-30-2013
    Location
    France
    MS-Off Ver
    2010
    Posts
    260

    Re: Macro opens word doc, want file path referenced from spreadsheet

    This probably doesn't directly resolve your issue but I've found that using the GetOpenFilename method works well as it doesn't require any typing from the user (thus mistakes & error handling).

    Please Login or Register  to view this content.

  5. #5
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Macro opens word doc, want file path referenced from spreadsheet

    Quote Originally Posted by Butcher1 View Post
    It didn't work. This macro would be executed from a different sheet than the "Admin Sheet" where the file path is, does the macro need that
    You'll need to name the sheet then I'm that same line of code above

    So range("h2") will look like range("sheet1!h2") where sheet1 is your sheet name

  6. #6
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Macro opens word doc, want file path referenced from spreadsheet

    Please Login or Register  to view this content.
    Here is my code in it's entirety. I am guessing I am misunderstanding something you said. I am getting an error at this line,
    Please Login or Register  to view this content.

  7. #7
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Macro opens word doc, want file path referenced from spreadsheet

    Sorry gave you a bum steer.

    Try this
    Please Login or Register  to view this content.
    Merry Christmas

  8. #8
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Macro opens word doc, want file path referenced from spreadsheet

    That got it to work, thank you! Merry Christmas to you too.

+ 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. [SOLVED] Excel macro that opens new MS Word file and pastes data as a pictu
    By Rob in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 PM
  2. Excel macro that opens new MS Word file and pastes data as a pictu
    By Rob in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  3. [SOLVED] Excel macro that opens new MS Word file and pastes data as a pictu
    By Rob in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  4. Excel macro that opens new MS Word file and pastes data as a pictu
    By Rob in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  5. [SOLVED] Excel macro that opens new MS Word file and pastes data as a pictu
    By Rob in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-06-2005, 01:05 PM

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