Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA Code to automate "Save As"

I would like to use a "Save As" VBA code to save a file
already open to another drive location. An example of my
code is below. Everytime this code runs it asks for
confirmation "yes/no" if I'd like to override the existing
file. I will always want to override it and would like a
line of VBA code to take care of that. Any ideas?

Thank you so much!

Kevin
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA Code to automate "Save As" - FORGOT TO INCLUDE THE CODE...

ActiveWorkbook.SaveAs Filename:= _
"H:\GRPSHARE\Intra-Day Performance.xls" _
, FileFormat:=xlNormal, Password:="",
WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False,
ConflictResolution:=xlLocalSessionChanges
-----Original Message-----
I would like to use a "Save As" VBA code to save a file
already open to another drive location. An example of my
code is below. Everytime this code runs it asks for
confirmation "yes/no" if I'd like to override the

existing
file. I will always want to override it and would like a
line of VBA code to take care of that. Any ideas?

Thank you so much!

Kevin
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default VBA Code to automate "Save As"

Kevin,

You can set Application.DisplayAlerts to False prior to the SaveAs to
prevent the dialog from appearing. E.g.,

Application.DisplayAlerts = False
' your code here
Application.DisplayAlerts = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com


"Kevin McLean" wrote in message
...
I would like to use a "Save As" VBA code to save a file
already open to another drive location. An example of my
code is below. Everytime this code runs it asks for
confirmation "yes/no" if I'd like to override the existing
file. I will always want to override it and would like a
line of VBA code to take care of that. Any ideas?

Thank you so much!

Kevin



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default VBA Code to automate "Save As"

This is an alternate to changing the DisplayAlerts property.

Check if the open file has the same name as the saveas filename. If it
does, then you can always use the Save command.

If ActiveWorkbook.FullName < sNewFullName Then
'Your code here...
'Save new workbook
ActiveWorkbook.SaveAs filename:=sNewFullName
Else
'Your code here...
'Save workbook
ActiveWorkbook.Save
End If

Bill Barclift


"Kevin McLean" wrote in message
...
I would like to use a "Save As" VBA code to save a file
already open to another drive location. An example of my
code is below. Everytime this code runs it asks for
confirmation "yes/no" if I'd like to override the existing
file. I will always want to override it and would like a
line of VBA code to take care of that. Any ideas?

Thank you so much!

Kevin



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
VBA code for "Save as PDF" Pritesh[_2_] Excel Discussion (Misc queries) 1 February 26th 10 02:41 PM
Selecting "Save As" adds "Copy of" to file name- MS Excel 2007 ronhansen Excel Discussion (Misc queries) 1 November 15th 09 09:33 PM
"CELL("FILENAME") NOT UPDATE AFTER "SAVE AS" ACTION yossie6 Excel Discussion (Misc queries) 1 June 16th 08 12:16 PM
Using code to automate "h:mm" hol Excel Discussion (Misc queries) 6 November 30th 07 02:57 PM
"Save" and "Save As" options greyed out - "Save as Webpage" option Bill Excel Discussion (Misc queries) 0 January 16th 07 04:47 PM


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