ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Microsoft's drop down box (https://www.excelbanter.com/excel-programming/385011-microsofts-drop-down-box.html)

Sulley

Microsoft's drop down box
 
Greetings,

I have a small request, I'm trying to save a file to my C drive and then get
it to save to my G drive. My question is ....
how do I get it to save to the G drive without Microsoft's drop down box
confirming (Yes) to replace the file?

Here is my code:

Sub Save()
ActiveWorkbook.Save
ChDir "G:\Excel Files"
ActiveWorkbook.SaveAs Filename:="G:\Excel Files\Audit Highlights.xls"
ChDir "c:\Temp 1"
End Sub

Any help would be greatly appreciated.



Alan[_2_]

Microsoft's drop down box
 
Sub Save()
Dim wbName As String
wbName = "G:\Excel Files\Audit Highlights.xls\Audit Highlights.xls"
ActiveWorkbook.Save
ActiveWorkbook.SaveAs wbName
End Sub

If you are overwriting an existing file you can suppress the alerts using:

Sub Save()
Dim wbName As String
wbName = "G:\Excel Files\Audit Highlights.xls\Audit Highlights.xls"
ActiveWorkbook.Save
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs wbName
Application.DisplayAlerts =True
End Sub

This is for a local drive G: only.
-------

Regards,

Alan


"Sulley" wrote in message
...
Greetings,

I have a small request, I'm trying to save a file to my C drive and then
get
it to save to my G drive. My question is ....
how do I get it to save to the G drive without Microsoft's drop down box
confirming (Yes) to replace the file?

Here is my code:

Sub Save()
ActiveWorkbook.Save
ChDir "G:\Excel Files"
ActiveWorkbook.SaveAs Filename:="G:\Excel Files\Audit Highlights.xls"
ChDir "c:\Temp 1"
End Sub

Any help would be greatly appreciated.





Jay

Microsoft's drop down box
 
Hi Sulley -

I'd suggest turning off display alerts before and after the "...SaveAs..."
statement as follows:

Sub Save()
Application.DisplayAlerts = False
ActiveWorkbook.Save
ChDir "G:\Excel Files"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:="G:\Excel Files\Audit Highlights.xls"
Application.DisplayAlerts = True
ChDir "c:\Temp 1"
End Sub
Close
--
Jay


"Sulley" wrote:

Greetings,

I have a small request, I'm trying to save a file to my C drive and then get
it to save to my G drive. My question is ....
how do I get it to save to the G drive without Microsoft's drop down box
confirming (Yes) to replace the file?

Here is my code:

Sub Save()
ActiveWorkbook.Save
ChDir "G:\Excel Files"
ActiveWorkbook.SaveAs Filename:="G:\Excel Files\Audit Highlights.xls"
ChDir "c:\Temp 1"
End Sub

Any help would be greatly appreciated.




Sulley

Microsoft's drop down box
 
Thanks Alan & Jay..... solved my problem.


"Sulley" wrote in message
...
Greetings,

I have a small request, I'm trying to save a file to my C drive and then
get
it to save to my G drive. My question is ....
how do I get it to save to the G drive without Microsoft's drop down box
confirming (Yes) to replace the file?

Here is my code:

Sub Save()
ActiveWorkbook.Save
ChDir "G:\Excel Files"
ActiveWorkbook.SaveAs Filename:="G:\Excel Files\Audit Highlights.xls"
ChDir "c:\Temp 1"
End Sub

Any help would be greatly appreciated.






All times are GMT +1. The time now is 06:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com