Specify excel sheet name on export

honor401

Registered User.
Local time
Today, 16:58
Joined
Aug 26, 2004
Messages
11
I am exporting a query out to excel.
I can give the work "book" a name but I need to specify the work "sheet's" name inside the work book instead of having excel give it the name of the query it was exported from...
is this possible?
thanks,
Scott
 
Try This

Instead of using .book use .sheets and assign it to your desired name or variable. I use:

PHP:
'When creating a new worksheet
.sheet(1).Name = strSheetName

'When looking for an existing worksheet
For intSheetCount = 1 To .sheets.Count
               If .sheets(intSheetCount).Name = (strSheetName) Then
                    blnSheetFound = True
                    xlsCreateHeaders = False
                    Exit For
               End If
Next

I hope that helps! :)
 

Users who are viewing this thread

Back
Top Bottom