Can someone please help me with the following code:
Dim NewOutputFile As Workbook
Set NewOutputFile = Workbooks.Add(FileName & ".xls")
where FileName = "C:\\Documents and Settings\\me\\My Documents\\file.xls"
I want to create a new workbook dynamically and then add new tabs:
NewOutputFile.Sheets.Add ("New tab")
EDIT when I say "workbook" I mean a new excel file
NewOutputFile.Sheets.Add().Name= "New tab"
或者,如果要添加工作表作为最后一个工作表:
NewOutputFile.Sheets.Add(After:=NewOutputFile.Sheets(NewOutputFile.Sheets.Count)).Name = "New tab"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.