Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Renaming a Sheet 1

Status
Not open for further replies.

mkjp2011

Programmer
Aug 24, 2010
15
US
How would I set the name of an excel sheet. I would use the following code to access the sheet object

Set excelReport = CreateObject("Excel.Application")
excelReport.Workbooks.Add
Set excelSheet1 = excelReport.ActiveWorkbook.WorkSheets(1)
Set excelSheet2 = excelReport.ActiveWorkbook.WorkSheets(2)
 


hi,
Code:
dim xl as object

set xl = CreateObject("Excel.Application")

with xl.workbooks.add[b]
   .worksheets(1).name = "Whatever"[/b]
   .saveas "your_choice.xlsx"
   .close
end with

xl.quit

set xl = nothing



Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top