Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default How to get an Excel file to save without the VB

I created a VB code in an excel workbook. It is a report that other people
will see. The code saves the excel file to a new excel file with the name
and current date. THis is the code I wrote:

Private Sub Workbook_BeforeClose(Cancel As Boolean)

ActiveWorkbook.SaveAs "C:\Documents and
Settings\Administrator\Desktop\AppleVacations_Open TKT Report TD " &
Format(Date, "dd-mmm-yy") & ".xls"

End Sub

The problem is that when a user opens the new file, it prompts them to
enable macros. It also alerts them that the file already exists when the try
to close and gives them a choice to replace the existing file. If they
choose no, then it wants to debug.

How can I get the file to save without the VB code so others can use it?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default How to get an Excel file to save without the VB

hi.
if you save the whole workbook then you save the whole workbook code and all.
you just want to save the current copy of the workbook data only.
so add somthing like this to the saveas code you have.....

Sheets("sheet1").Copy 'change to suit
Workbooks.Add
Range("A1").PasteSpecial xlPasteAll
ActiveWorkbook.SaveAs "c:\ect\ect\ect......

if i'm not mistaken, using the above code, excel may automaticly add a new
workbook when using the copy sheet method. play with it. thing is...don't
save the whole workbook, just copy the data you want to a new workbook.

regards
FSt1

"Charles Stover" wrote:

I created a VB code in an excel workbook. It is a report that other people
will see. The code saves the excel file to a new excel file with the name
and current date. THis is the code I wrote:

Private Sub Workbook_BeforeClose(Cancel As Boolean)

ActiveWorkbook.SaveAs "C:\Documents and
Settings\Administrator\Desktop\AppleVacations_Open TKT Report TD " &
Format(Date, "dd-mmm-yy") & ".xls"

End Sub

The problem is that when a user opens the new file, it prompts them to
enable macros. It also alerts them that the file already exists when the try
to close and gives them a choice to replace the existing file. If they
choose no, then it wants to debug.

How can I get the file to save without the VB code so others can use it?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default How to get an Excel file to save without the VB

Prompting to enable macros is the local MSexcel security setting.

If you want the file to be overwritten without an alert; disable the
DisplayAlert ...and enable it back after saving the file..

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs "c:\book1"
Application.DisplayAlerts = True

If this post helps click Yes
---------------
Jacob Skaria


"Charles Stover" wrote:

I created a VB code in an excel workbook. It is a report that other people
will see. The code saves the excel file to a new excel file with the name
and current date. THis is the code I wrote:

Private Sub Workbook_BeforeClose(Cancel As Boolean)

ActiveWorkbook.SaveAs "C:\Documents and
Settings\Administrator\Desktop\AppleVacations_Open TKT Report TD " &
Format(Date, "dd-mmm-yy") & ".xls"

End Sub

The problem is that when a user opens the new file, it prompts them to
enable macros. It also alerts them that the file already exists when the try
to close and gives them a choice to replace the existing file. If they
choose no, then it wants to debug.

How can I get the file to save without the VB code so others can use it?

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
excel 2003 file converted to .xlsm file when save to network drive Chris Excel Discussion (Misc queries) 3 January 23rd 08 02:56 PM
auto save excel file every 10 minutes to its original file name MEG Excel Discussion (Misc queries) 3 September 8th 05 07:12 PM
'document not saved' for 'save' or 'save as' an EXCEL file Judy Chuang Excel Discussion (Misc queries) 1 July 11th 05 10:12 PM
Save & Save As features in file menu of Excel Blue Excel Discussion (Misc queries) 9 December 27th 04 08:49 PM
Save Excel file - prompts to save - no Volitile functions used POWER CERTS Excel Worksheet Functions 2 November 1st 04 09:27 PM


All times are GMT +1. The time now is 01:03 AM.

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

About Us

"It's about Microsoft Excel"