Results 1 to 7 of 7
  1. #1
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    FileSave Macro (2002)

    Does Excel VBA allow FileSave, etc. macros that can be used to replace the built-in functionality like Word does?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FileSave Macro (2002)

    No, not the same way. In Excel you would use the Workbook BeforeSave event routing to get control when the file is saved.
    Legare Coleman

  3. #3
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FileSave Macro (2002)

    You have confirmed my suspicions. Oh well, workbook events it'll have to be. Thanks, Legare!
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: FileSave Macro (2002)

    In fact, to get as close to replacing built-in commands as possible, you want to Excel application level events, not individual workbook level events. Since Excel workbooks are in no way tied to a template, a Workbook_Open event will only apply to the workbook it is in, but something like xlApp_WorkbookOpen (where xlApp is a variable of type Application) will apply to every workbook.

  5. #5
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FileSave Macro (2002)

    If I code up the WorkBook BeforeSave event in a template (xls) and create workbooks from it, will the aforementioned event be included in the workbook?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: FileSave Macro (2002)

    Yes, but you have to be aware of the fundamental differences between creating a Word document from a template and creating an Excel workbook from a template. Excel simply creates a complete copy of the template, complete with the styles, macros and toolbars in the template. There is no connection between the new workbook and the template, so if you modify a macro in the template, this will not influence existing workbooks created from the template.

    In short, a Workbook_BeforeSave macro in a template will be copied to every workbook you create from it.

  7. #7
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FileSave Macro (2002)

    Ok, that's cool. I agree App events are the better way to go, but for this little template, I'll probably just code the workbook event. The automony between workbook and template is ok here. Thanks Hans!
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •