+ Reply to Thread
Results 1 to 5 of 5

Embedded Excel Object - Updating Formulas

  1. #1
    Registered User
    Join Date
    09-28-2011
    Location
    Windsor
    MS-Off Ver
    Excel 2007
    Posts
    15

    Embedded Excel Object - Updating Formulas

    I have an excel file I use daily for work that I give an updated file name every few days by changing the date, i.e. PO Log 2018-10-08 would become PO Log 2018-10-10. This helps me feel better about losing minimal data in an unforeseen circumstance.

    The workbook has a lot of tabs and information and can sometimes the data displayed can become a bit overwhelming so what I tried doing was embedding a separate excel file as an object inside the main parent file to clean the look up a bit. This embedded file is basically a table that I don't need to reference very often but I would like to have the parent document be able to pull data from the embedded document and vise versa. This works great when the formulas are first set up but as soon as I rename the parent document, the formulas in the embedded document always link back to the old revision of the parent file instead of the newly revised parent file name which is the file its embedded in.

    Is there a workaround for this to force excel to always pull data from the file it's embedded in rather than it pulling an external reference from the outdated file name source workbook?

    Any help would be appreciated - thanks

  2. #2
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Embedded Excel Object - Updating Formulas

    For stuff like this, I usually check out the =CELL() function. I played around a bit with an embedded spreadsheet and didn't find anything obvious as the "filename" parameter seemed to show the last one you input.

    Barring that, a macro could look at your files (assuming you use a standard naming convention) and determine the most recently updated file or be smart enough to parse the filename. It would then update your formulas. Still a bit messy, as I'm not quite sure how the worksheet open event would handle embedded tables.
    Pauley
    --------
    If I helped with your issue, I'd appreciate a rep bump (hit the '*' icon to the bottom left of this post).

  3. #3
    Registered User
    Join Date
    09-28-2011
    Location
    Windsor
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Embedded Excel Object - Updating Formulas

    I have yet to come up with a viable solution so I am thinking VBA might be the way to go.

    I started searching around and came up with this as a starting point with the idea that I can set named ranges in the parent workbook that the embedded workbook can reference. I feel like I am onto something but still have a long way to go.

    Please Login or Register  to view this content.
    I can get this code to bring up the correct messageboxes when I run the code in the parent workbook but I get a "run time error 1004" when I run it via the embedded workbook. I was hoping somebody could help point me in the right direction as I am a novice when it comes to VBA.

  4. #4
    Registered User
    Join Date
    09-28-2011
    Location
    Windsor
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Embedded Excel Object - Updating Formulas

    I realized I cannot use my earlier approach because the named ranges are not visible to the embedded sheet. As a workaround I've come up with a solution that will work except that I can't get a piece of code to run in the embedded sheet because for some reason the embedded sheet does not retain any macro or code information (after every save the code I enter disappears as though it was never there).

    The code below I placed in the parent worksheet. I have the code set to run when I click a button (all it does is open the embedded workbook which it does just fine).

    Please Login or Register  to view this content.
    The above code works fine it's the code below I am having an issue with. I've tried having the code run in sequence with the code above, as a second button in the embedded file and have the code run with the workbook_open event but I have had no luck with either approach (there is probably something simple and obvious I am missing). All I am trying to do is populate a cell with either the parent filename or the embedded file name when the file is opened or when I click a button - from there I have other formulas in the spreadsheet that pull that information and retrieve the data I need. Unfortunately the built in =CELL() function can't seem to return the filename I need (maybe if I can get that to work it could solve my issues). Here is what I have for now:


    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    Please any help is appreciated. Thanks.

  5. #5
    Registered User
    Join Date
    09-28-2011
    Location
    Windsor
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Embedded Excel Object - Updating Formulas

    I found a messy workaround using the User Defined Function below

    Please Login or Register  to view this content.
    I had to store the UDF in the PERSONAL MACRO WORKBOOK and then entered the following formula in a cell that references the UDF

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    For some reason I cannot store macros in an embedded workbook so this was the only solution I could come up with.

+ 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. Excel Object embedded in PPT resizes
    By SUPPO_USN in forum Excel General
    Replies: 1
    Last Post: 06-02-2017, 09:49 AM
  2. Macro to access embedded excel object
    By SUPPO_USN in forum PowerPoint Formatting & General
    Replies: 1
    Last Post: 04-27-2017, 09:19 AM
  3. Help with VBA Excel Range to Embedded Word Object
    By cuchulainem in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-28-2013, 04:53 PM
  4. set calculation property in embedded excel object
    By erickd in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-17-2010, 03:55 PM
  5. Embedded Excel Object - Containers Path and Name
    By GerryO in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-21-2006, 10:40 AM
  6. Excel 2000 exits on embedded msword object
    By Ava in forum Excel General
    Replies: 0
    Last Post: 05-04-2005, 07:06 PM
  7. Replies: 0
    Last Post: 03-02-2005, 09:18 AM

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