Excel sheet invisible

fredalina

Registered User.
Local time
Today, 03:36
Joined
Jan 23, 2007
Messages
163
i have a spreadsheet name stored in variable Spread1. This is the full path name that is opened in Access VBA earlier in the code. i have the foreshortened version of the spreadsheet name (i.e. "Test12-2008.xls") stored in variable Spread2.

The following code generates a "Subscript out of range" error:
Code:
xlWrkBk.Parent.Windows(Spread2).Visible = True

where the value of Spread2 is "Exporttemplate12-2008.xls" (quotation marks included). If i omit this line of code, the spreadsheet is saved and sent out in an email and users cannot view the spreadsheet at all (in fact, i cannot even tell if previous code that set the cell values worked since i can't see it!).

The variables Spread1 and Spread2 are used because a new spreadsheet is created each month.

Can you help me?
 
As it turns out, the name of the spreadsheet is not required in the
Code:
xlWrkBk.Parent.Windows(Spread2).Visible = True
code.

This works fine:
Code:
xlWrkBk.Parent.Windows(1).Visible = True

(Just updating for anyone who may search and stumble upon this one day).
 

Users who are viewing this thread

Back
Top Bottom