Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autosave excel file

Can anyone tell me how to automatically copy an Excel file to anothe
location when I open it? I'm trying to allow people to view a copy of
file each time I update it.

Many thanks

Stev

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Autosave excel file

copy this code in your 'This Workbook' module. check for
the parameters of SaveAs method in the vba help

Private Sub Workbook_Open()
Application.DisplayAlerts = False ' this will not ask you _
'if you want to replace the existing file
ActiveWorkbook.SaveAs (filepath,....)
Application.DisplayAlerts = True
End Sub

this will save it as a file everytime you open this file
even if you are opening it to update the file.

Private Sub Workbook_BeforeClose()
ActiveWorkbook.SaveAS (...)
End sub


hope this helps

-----Original Message-----
Can anyone tell me how to automatically copy an Excel

file to another
location when I open it? I'm trying to allow people to

view a copy of a
file each time I update it.

Many thanks

Steve


---
Message posted from http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Autosave excel file

hi,
dont mean to be rude, but dont you want to save the book, when you
close it?, otherwise you'll be "publishing" the new one only after you
have closed it and THEN reopen it, so yu might open the file, it's
publsihed, do some work then close it. you get ill, and dont open the
book for another few day, so the thing hasn't been updated.
If i was you i would use the code, that nice man gave you, but put it
in the "before close" event of the workbook, or.... beter still in a
command button/toolbar button, this way you can have more contol of
when you "publish" you updates - alowwing you to edit, save and not
"publish", or "publish" half way though.

just some ideas

good luck
rosscoe
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autosave excel file

I pasted this into the ThisWorkbook module:

Private Sub Workbook_BeforeClose()
ActiveWorkbook.SaveAs ("C:\Test.xls")
End Sub

However, after making changes to the workbook and saving I get th
following error message on exit:

Compile error: Procedure declaration does not match description o
event or procedure having the same name

Being a complete novice at VB can you put me right please?

I tried Excel's own "File\Save as\Tools\ General Options\Always make
backup" but this only works for "Save As" not just "Save"

TIA

Stev

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Autosave excel file

If you let excel help you when you create that sub, you'll be better off.

Rename your sub to something else.

Then use the dropdowns at the top of the code window to choose both the Workbook
(not (General)) and Before_Save event.

You should see the procedure shell start like:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

=======
But I don't think "Always create backup" works the way you say. You change the
option via the file|saveas dialog, but it'll create a backup with a normal Save,
too.

I think I would have used the beforesave event. You may want to look at
responses to your other posts.




"selsley <" wrote:

I pasted this into the ThisWorkbook module:

Private Sub Workbook_BeforeClose()
ActiveWorkbook.SaveAs ("C:\Test.xls")
End Sub

However, after making changes to the workbook and saving I get the
following error message on exit:

Compile error: Procedure declaration does not match description of
event or procedure having the same name

Being a complete novice at VB can you put me right please?

I tried Excel's own "File\Save as\Tools\ General Options\Always make a
backup" but this only works for "Save As" not just "Save"

TIA

Steve

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I find a deleted excel file? Or an autosave file? Aladriel Excel Discussion (Misc queries) 10 January 3rd 08 07:46 PM
Excel 2003 autosave a changing file LeProf Excel Discussion (Misc queries) 2 January 18th 07 12:31 AM
Autosave workbook as unique file Allen Excel Discussion (Misc queries) 1 June 15th 06 04:19 PM
How do I autosave a unique Excel file in the file format 03F67000 flyboy06 Setting up and Configuration of Excel 1 June 14th 06 11:11 PM
Opened Autosave but when closing workbook Autosave closes itself Ken Excel Worksheet Functions 0 October 29th 05 05:11 PM


All times are GMT +1. The time now is 09:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"