Need some help with VBA in Excel 2007

GEC: Discuss gaming, computers and electronics and venture into the bizarre world of STGODs.

Moderator: Thanas

Post Reply
eyl
Jedi Knight
Posts: 714
Joined: 2007-01-30 11:03am
Location: City of Gold and Iron

Need some help with VBA in Excel 2007

Post by eyl »

I'm having a bit of difficulty with a VBA function in Excel 2007; I'm hoping someone might have an idea how to solve it.

During the course of the program, I need to add a new workbook. Usually, I'd simply use WorkBooks.Add (the Add method for the WorkBooks collection). The catch is that I need the new workbook to be in Excel 2007 format (since I need more than 256 columns in the worksheet). It's my understanding that WorkBook.Add opens the new workbook in the format which is currently set as the default, which is Excel 2003 in my case, and indeed I'm getting 256-column worksheets. I'd rather not change the default to xlsx.

Does anyone know of a way to force the creation of the new workbook in xlsx format?

Thx
User avatar
phongn
Rebel Leader
Posts: 18487
Joined: 2002-07-03 11:11pm

Re: Need some help with VBA in Excel 2007

Post by phongn »

Take a look at the reference documentation here - in particular the second example. If you immediately save the file, you can set various fields in the SaveAs method such as the new format.
Post Reply