Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
I have the following macro to save the Index sheet as a new workbook "abc" in csv format. Since I have the abc.csv file in the c:\ directory, Excel will ask me whether I want to overwrite the file. So I have the application.sendkeys to say Yes to overwrite. This works fine if I am running it manually but the macro stops at the overwrite question if I scheduled the macro to run. Then I have to hit yes and the macro finishes it up. Do you know how I can fix this issue? Thank you in advance. Joanne Sheets("Index").Select Sheets("Index").Copy Application.SendKeys ("Y~") ActiveWorkbook.SaveAs Filename:="c:\abc.csv", _ FileFormat:=xlCSV, CreateBackup:=False ActiveWindow.Close |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Put application.displayalerts = false before the saveas line and
application.displayalerts = true after the line. Cliff Edwards |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Since you're closing the new workbook, return displayalerts to true
after that action. Sub copySheet() Sheets("Index").Copy Application.DisplayAlerts = False ActiveWorkbook.SaveAs Filename:="C:\abc.csv", _ FileFormat:=xlCSV, CreateBackup:=False ActiveWindow.Close Application.DisplayAlerts = True End Sub Cliff Edwards |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Cliff,
That works... thank you very much. Joanne "ward376" wrote: Since you're closing the new workbook, return displayalerts to true after that action. Sub copySheet() Sheets("Index").Copy Application.DisplayAlerts = False ActiveWorkbook.SaveAs Filename:="C:\abc.csv", _ FileFormat:=xlCSV, CreateBackup:=False ActiveWindow.Close Application.DisplayAlerts = True End Sub Cliff Edwards |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Script problem on excel spanish version | Excel Programming | |||
Problem with Excel VBA script, decimal bug | Excel Programming | |||
problem with SaveAs method of excel in IIS 5 | Excel Programming | |||
Problem with printing from VB-script in Excel | Excel Programming | |||
Weird Problem: Excel SaveAs-- document not saved | Excel Programming |