[Solved] VBA : Embeded Document in Excel

  • Hi,


    I have a spreadsheet that is sent out to a number of users. as part of the sheet there is a standard letter which is embeded into the spreadsheet. i have written a macro to update this embeded file with information from the spreadsheet.


    however when the documnent is closed it saves any changes into the embeded file.


    i need this file to be a clean template for the next time the macro is run.
    Can someone suggest a way to stop the embeded file being saved? or perhaps another solution to this problem?


    Many thanks
    Alan

  • Hi,


    Try embedding two documents.


    When the macro is run, the "live" document is first replaced by a copy of the "back up" document. This way you'll always edit a copy and never directly edit the back up.


    John

  • Thanks John, i used your idea and came up with the VBA code:
    ActiveSheet.Shapes("ENGLISH1").Delete
    ActiveSheet.Shapes("ENGLISH").Select
    Selection.Copy
    Selection.Verb Verb:=xlOpen
    Selection.Name = "ENGLISH1"
    ActiveSheet.Paste


    this copies the template, opens it, renames the file and pastes a fresh template for next time around.


    Cheers
    Alan

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!