View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
David Nicholson David Nicholson is offline
external usenet poster
 
Posts: 1
Default 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