Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-26-2015, 04:06 PM
Macer Macer is offline Can DocumentBeforeSave replace FileSaveAs Windows 7 64bit Can DocumentBeforeSave replace FileSaveAs Office 2007
Novice
Can DocumentBeforeSave replace FileSaveAs
 
Join Date: Jan 2015
Posts: 9
Macer is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old 02-26-2015, 04:11 PM
Macer Macer is offline Can DocumentBeforeSave replace FileSaveAs Windows 7 64bit Can DocumentBeforeSave replace FileSaveAs Office 2007
Novice
Can DocumentBeforeSave replace FileSaveAs
 
Join Date: Jan 2015
Posts: 9
Macer is on a distinguished road
Default

I tried showing my logic, but it removed all of my lines.
Reply With Quote
  #3  
Old 06-05-2015, 10:03 PM
macropod's Avatar
macropod macropod is offline Can DocumentBeforeSave replace FileSaveAs Windows 7 64bit Can DocumentBeforeSave replace FileSaveAs Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can DocumentBeforeSave replace FileSaveAs DocumentBeforeSave Event doesn't apply to all exports to PDF ARK275 Word VBA 3 02-09-2015 07:06 AM
Can DocumentBeforeSave replace FileSaveAs 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
Can DocumentBeforeSave replace FileSaveAs 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

Other Forums: Access Forums

All times are GMT -7. The time now is 09:53 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft