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


Hi,
Im trying to create an auto save/ backup routine when the User closes out
of XL2007, but I keep running into an error that prevents the workbook from
being saved. The workbook is created from a template and Ive tried saving
the template as a regular template and as a macro-enabled template, but
either way it produces the same error. Ive even tried changing the filename
to €œC:\Amess.xls*€ with no luck. The code is listed below.

From the template/workbook (ThisWorkbook):
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Run "Personal.xls!EndIt", Cancel
End Sub

From Personal.xls (standard module):
Sub EndIt(Cancel As Boolean)
On Error Resume Next
Error occurs here= ActiveWorkbook.SaveAs Filename:=extPath & grade & "\" &
fName & €œ.xls*€
Application.Caption = Empty
Application.CommandBars("Worksheet menu bar").Controls("&USD 501").Delete
myMnu = Nothing
Toolbars("Standard").Reset
Application.DisplayAlerts = True
End Sub

Error:
The following features cannot be saved in macro-free workbooks:
VB Project
To save a file with these features, click No, and then choose a
macro-enabled file type in the File Type list.
To continue saving as a macro-free workbook, click Yes.

Does anyone have any idea as to what may be happening here and how to fix it?
Thanks, Mark

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Auto save question


what is the value in fname?

you should try a name without any extension, and let excel add that as a
default

eg

ActiveWorkbook.SaveAs "abc", xlWorkbookNormal

"Mark" wrote in message
...
Hi,
Im trying to create an auto save/ backup routine when the User closes out
of XL2007, but I keep running into an error that prevents the workbook
from
being saved. The workbook is created from a template and Ive tried saving
the template as a regular template and as a macro-enabled template, but
either way it produces the same error. Ive even tried changing the
filename
to €œC:\Amess.xls*€ with no luck. The code is listed below.

From the template/workbook (ThisWorkbook):
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Run "Personal.xls!EndIt", Cancel
End Sub

From Personal.xls (standard module):
Sub EndIt(Cancel As Boolean)
On Error Resume Next
Error occurs here= ActiveWorkbook.SaveAs Filename:=extPath & grade & "\"
&
fName & €œ.xls*€
Application.Caption = Empty
Application.CommandBars("Worksheet menu bar").Controls("&USD 501").Delete
myMnu = Nothing
Toolbars("Standard").Reset
Application.DisplayAlerts = True
End Sub

Error:
The following features cannot be saved in macro-free workbooks:
VB Project
To save a file with these features, click No, and then choose a
macro-enabled file type in the File Type list.
To continue saving as a macro-free workbook, click Yes.

Does anyone have any idea as to what may be happening here and how to fix
it?
Thanks, Mark

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default Auto save question


Hi Patrick,
The full Filename is:
extPath = C:\Documents and Settings\HP_Owner\My Documents\2009_2010\
grade=1st Grade
"\"
fName=Roxbury East_Adams

or

C:\Documents and Settings\HP_Owner\My Documents\2009_2010\1st Grade\Roxbury
East_Adams

The pathway does exist and removing the extension made no difference. This
originally worked in XL2000, but hasn't worked since "upgrading" to 2007.

When I removed "Filename:=" from the erroring line of code, it worked
perfectly!

Thanks, so much, Patrick - I appreciate your help!
Mark

"Patrick Molloy" wrote:

what is the value in fname?

you should try a name without any extension, and let excel add that as a
default

eg

ActiveWorkbook.SaveAs "abc", xlWorkbookNormal

"Mark" wrote in message
...
Hi,
Im trying to create an auto save/ backup routine when the User closes out
of XL2007, but I keep running into an error that prevents the workbook
from
being saved. The workbook is created from a template and Ive tried saving
the template as a regular template and as a macro-enabled template, but
either way it produces the same error. Ive even tried changing the
filename
to €œC:\Amess.xls*€ with no luck. The code is listed below.

From the template/workbook (ThisWorkbook):
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Run "Personal.xls!EndIt", Cancel
End Sub

From Personal.xls (standard module):
Sub EndIt(Cancel As Boolean)
On Error Resume Next
Error occurs here= ActiveWorkbook.SaveAs Filename:=extPath & grade & "\"
&
fName & €œ.xls*€
Application.Caption = Empty
Application.CommandBars("Worksheet menu bar").Controls("&USD 501").Delete
myMnu = Nothing
Toolbars("Standard").Reset
Application.DisplayAlerts = True
End Sub

Error:
The following features cannot be saved in macro-free workbooks:
VB Project
To save a file with these features, click No, and then choose a
macro-enabled file type in the File Type list.
To continue saving as a macro-free workbook, click Yes.

Does anyone have any idea as to what may be happening here and how to fix
it?
Thanks, Mark

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
auto save feature (not auto recovery) Dawnee Excel Discussion (Misc queries) 3 January 20th 09 09:47 PM
Excel 2007 auto-recovery / auto-save? gpurdue Setting up and Configuration of Excel 0 May 23rd 08 10:19 PM
How to AUTO SAVE as opposed to turning on auto recovery: EXCEL T-mo Excel Discussion (Misc queries) 1 January 12th 06 10:16 PM
2 Part question involving SaveAs and Auto Save when quit. ryanmhess Excel Programming 0 September 1st 05 09:47 PM
Auto Excel workbook close: save= false during an auto subroutine tomwashere2 Excel Programming 10 June 16th 05 06:23 AM


All times are GMT +1. The time now is 09:32 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"