#1
|
|||
|
|||
Can DocumentBeforeSave replace FileSaveAs
This is probably a long shot but I was wondering if there was a way that I could use Documentbeforesave() to work like FileSaveAs() and FileSave() events. My code for those events did work until we transferred to Office 2013. I was using FileSaveAs and FileSave to save a file then run the my code afterward. My code needs to be afterward because it tracks file locations and logs it in another file. Since DocumentBeforeSave runs on any type of save, I was thinking I need logic kind of like the following. Sub DocumentBeforeSave()| If SaveAs was selected| Run SaveAs| Run my Macro| Prevent SaveAs from running| again. Exit Sub | else If Save was selected | Run Save | Run my Macro | Prevent Save from running again. | Exit else End Sub | Is it possible to do this or am I just trying to create the impossible. Last edited by Macer; 02-27-2015 at 02:56 PM. |
#2
|
|||
|
|||
I tried showing my logic, but it removed all of my lines.
|
#3
|
||||
|
||||
Without seeing your actual code, it's impossible to say why something that worked in Office 2007 doesn't work under Office 2013.
As for your logic, your SaveAs & Save subs could both call the same sub to log the details, but I can't see where the requirement to Prevent SaveAs or Save from running again would apply. After all, what do you intend to happen if the user makes further changes to the file, or wants to create a second copy via SaveAs?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
DocumentBeforeSave Event doesn't apply to all exports to PDF | ARK275 | Word VBA | 3 | 02-09-2015 07:06 AM |
VBA Batch Find & Replace for all MSOffice extensions, to replace File Name and Content of the File | QA_Compliance_Advisor | Word VBA | 11 | 09-11-2014 11:51 PM |
Help with find and replace or query and replace | shabbaranks | Excel | 4 | 03-19-2011 08:38 AM |
filesaveas method for ms project in c# results in error | mikimik | Project | 0 | 10-12-2006 07:53 AM |
FileSaveAs with Code | bsmith | Office | 0 | 01-05-2006 08:43 AM |