Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

'4th sheet' in excel macro problem

Hi All,

Have a macro that was quite happy in excel until I added the 'bold' line (which I added because later I need to use sheet4, sheet5 etc.)

Now it fails on the 'set xlsheet bit' with 'object doesn't support this property or method 'xldoc worksheet'

Any ideas please ?

Thanks in advance

Bob

sub weeklyexport

set XLApp = CreateObject("Excel.Application") XLApp.Visible = True

set XLDoc = XLApp.Workbooks.Add

set XLDoc = XLApp.Worksheets.Add

set xlSheet=XlDoc.Woksheets("Sheet1")

xlSheet.Activate

......

end sub

1 Solution

Accepted Solutions
m_woolf
Master II
Master II

Your bold line changes the XLDoc object from a Workbook object (previous line) to a Worksheet object

You have also misspelled worksheet in the set xlSheet line

View solution in original post

2 Replies
m_woolf
Master II
Master II

Your bold line changes the XLDoc object from a Workbook object (previous line) to a Worksheet object

You have also misspelled worksheet in the set xlSheet line

Not applicable
Author

Thanks Michael - it was the object issue