ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   problem with macros using Excel 2007 (https://www.excelbanter.com/excel-programming/424915-problem-macros-using-excel-2007-a.html)

David Nicholson

problem with macros using Excel 2007
 
I have the following macro that was created under old excel and now that we
are on Excel 2007 it is no longer working. The workbook contains two sheets
that are hidden. It seems that the macro is grabbing the last sheet and
saving it as CSV instead of the one being activated.

Sub CreateOutputFile()

' Macro created 8/29/2002 by Del Evans

Application.StatusBar = "Creating Output Files, Please Wait . . ."
Application.ScreenUpdating = False

On Error GoTo 0
'Save the Treasury Spreadsheet
ThisWorkbook.Worksheets("Treasury Work Area").Activate
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\All Users\Documents\Treasury ARE
Worksheet.xls", FileFormat:=xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False


On Error GoTo 0
'Create the CSV file for the SAP BW Upload
ThisWorkbook.Worksheets("Upload Data").Activate
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\All Users\Documents\AREEXCTR.csv",
FileFormat:= _
xlCSV, CreateBackup:=False

Application.StatusBar = "Output Files Created"
Call MsgBox("Output Files Created", vbOKOnly, "Done!")
Application.StatusBar = False

End Sub




All times are GMT +1. The time now is 04:06 AM.

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