[AccessD] Quick VBA question - Selecting Cell In Excel

McGillivray, Don [IT] Donald.A.McGillivray at sprint.com
Tue Jun 19 18:13:02 CDT 2007


John,

I think ranges and cells belong to the Sheet object.  You probably need to fully qualify the reference.

Don

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Skolits
Sent: Tuesday, June 19, 2007 3:36 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Quick VBA question - Selecting Cell In Excel

This has to be a no brainer.

Using VBA I just want to select an Excel sheet and select a cell.

Set objXLBook = GetObject("c:\test.xls")


I can make the correct sheet active by using:

objXLBook.Sheets("Sheet2").Select


but then can't select the cell. I tried

objXLBook.Range(.Cells(1, 2)).Select
or 
objXLBook.Range("B1").Select

What's the correct syntax?
The error I get is 
"Object doesn't support this property or method"

Maybe I shouldn't be using the "Range" reference?

John Skolits




-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com






More information about the AccessD mailing list