Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-24-2017, 04:27 PM
brent chadwick brent chadwick is offline Auto save macro Windows 8 Auto save macro Office 2013
Advanced Beginner
Auto save macro
 
Join Date: Mar 2015
Posts: 86
brent chadwick is on a distinguished road
Default Auto save macro

Hey Guys,


Working on an auto save macro on Mac. This code works well so far except for two things: you need to save the first time manually with the Command +S, and when you do save manually later on it gives me the dialog box, which is annoying since if I am saving manually I don't want to see the dialog box. Suggestions?


Code:
Public Sub FileSave()
'Auto Save macro
ActiveDocument.SaveAs
DoEvents
Application.OnTime _
When:=Now + TimeValue("00:10:00"), _
Name:="FileSave"
MsgBox "10 Minutes have elapsed since this document was saved. Do you want this " & ActiveDocument.Name & " document saved now?", 3
Application.StatusBar = "Auto Saved: " & ActiveDocument.Name
End Sub
Reply With Quote
  #2  
Old 10-24-2017, 05:04 PM
macropod's Avatar
macropod macropod is offline Auto save macro Windows 7 64bit Auto save macro Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,370
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

Well, if the document has never been saved, you'll need the dialogue box. To suppress it for subsequent saves, try something along the lines of:
Code:
Public Sub FileSave()
'Auto Save macro
If ActiveDocument.Path = "" Then Application.Dialogs(wdDialogFileSaveAs).Show
DoEvents
Application.OnTime _
When:=Now + TimeValue("00:10:00"), _
Name:="FileSave"
MsgBox "10 Minutes have elapsed since this document was saved. Do you want this " & ActiveDocument.Name & " document saved now?", 3
Application.StatusBar = "Auto Saved: " & ActiveDocument.Name
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 10-24-2017, 05:15 PM
brent chadwick brent chadwick is offline Auto save macro Windows 8 Auto save macro Office 2013
Advanced Beginner
Auto save macro
 
Join Date: Mar 2015
Posts: 86
brent chadwick is on a distinguished road
Default

Thanks Paul, having the dialog box show up at the time interval is fine, I expect that. It is when I save in between times that I don't need to have the dialog box show up.
Reply With Quote
  #4  
Old 10-24-2017, 05:26 PM
macropod's Avatar
macropod macropod is offline Auto save macro Windows 7 64bit Auto save macro Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,370
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

What don't you want to show - a dialogue box or the message box?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 10-24-2017, 05:28 PM
brent chadwick brent chadwick is offline Auto save macro Windows 8 Auto save macro Office 2013
Advanced Beginner
Auto save macro
 
Join Date: Mar 2015
Posts: 86
brent chadwick is on a distinguished road
Default

If I am saving the doc I don't want to see the dialog box with the options-to me it's redundant if I have already chosen to save it-
Reply With Quote
  #6  
Old 10-24-2017, 05:30 PM
macropod's Avatar
macropod macropod is offline Auto save macro Windows 7 64bit Auto save macro Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,370
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

In that case:
Code:
Public Sub FileSave()
'Auto Save macro
If ActiveDocument.Path = "" Then
  Application.Dialogs(wdDialogFileSaveAs).Show
Else
  ActiveDocument.Save
End If
DoEvents
Application.OnTime When:=Now + TimeValue("00:10:00"), Name:="FileSave"
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 10-24-2017, 05:41 PM
brent chadwick brent chadwick is offline Auto save macro Windows 8 Auto save macro Office 2013
Advanced Beginner
Auto save macro
 
Join Date: Mar 2015
Posts: 86
brent chadwick is on a distinguished road
Default

I don't think I am explaining what I want to happen correctly. When I forget to save a doc I want the timer to kick in and show me the message box with the option to save or not. There are other times that I save a doc almost every 2 or 3 minutes, that is when I use the Command+S and do not need to have the message box appear. Is this a little clearer? Thanks for your help-
Reply With Quote
  #8  
Old 10-24-2017, 06:06 PM
macropod's Avatar
macropod macropod is offline Auto save macro Windows 7 64bit Auto save macro Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,370
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

In that case, you might need to re-assign the Ctrl-S shortcut to point to your macro.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 10-24-2017, 06:16 PM
brent chadwick brent chadwick is offline Auto save macro Windows 8 Auto save macro Office 2013
Advanced Beginner
Auto save macro
 
Join Date: Mar 2015
Posts: 86
brent chadwick is on a distinguished road
Default

How bout a simple save macro that I can assign to an other shortcut?
Reply With Quote
  #10  
Old 10-24-2017, 06:56 PM
macropod's Avatar
macropod macropod is offline Auto save macro Windows 7 64bit Auto save macro Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,370
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

The point of changing Ctrl-S is so it resets your timer. Using another shortcut means you need to remember to use that instead of Ctrl-S.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #11  
Old 10-25-2017, 08:26 AM
brent chadwick brent chadwick is offline Auto save macro Windows 8 Auto save macro Office 2013
Advanced Beginner
Auto save macro
 
Join Date: Mar 2015
Posts: 86
brent chadwick is on a distinguished road
Default

FYI you cannot override the Command+S shortcut on a Mac. So I did another simple macro that I trigger with the Ctrl+S shortcut. I think I can remember this combo.

Code:
Sub Save2()
'Extra Save macro
ActiveDocument.Save
Application.StatusBar = "Brent Saved: " & ActiveDocument.Name
End Sub
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto save macro Macro to save as pdf with ability to choose save as folder rvessio Word VBA 4 07-25-2016 12:37 PM
Auto save macro Auto save has done dark - does not work for me bitraker Word 1 12-28-2015 09:40 AM
Auto save macro Auto correct will not save shewoman Word 4 10-28-2015 03:51 AM
I was working on it had my auto save set to every 4 mins and all was well VernonMax Word 2 05-18-2015 08:58 AM
Auto save emails to server Chuuuuck Outlook 1 11-03-2011 02:17 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:40 PM.


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