Name spreadsheet

  • Thread starter Thread starter Jake F
  • Start date Start date
J

Jake F

I'm working on exporting a query to an excel spreadsheet. I need the sheet to
be called "100 - Night Weekend - All" but I get a subscript out of range
error or __ instead of the -.
 
You're not at the United States Military Academy, are you?
--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 
Use the TransferSpreadsheet method to export the query results to the
spreadsheet.

Then use Automation to open Excel, open the spreadsheet, change the sheet
name, and then close the spreadsheet.

It's been a while since I've done this, but the code to open Excel and make
the changes is something like:

Dim xl As Object
Dim wbk As Object

Set xl = CreateObject("excel.application")
xl.Visible = True
xl.Workbooks.Open "C:\xxx\sss.xls"
set wbk = xl.workbooks(1)
xl.Worksheets(1).Name = "100 - Night Weekend - All"
wbk.Close True
xl.Quit

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 
At the military academy (USMA) 100th night is a celebration of 100 nights
from graduation.

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 
Back
Top