John Skolits
askolits at ot.com
Tue Jun 19 18:25:49 CDT 2007
I tried that with the following:
Dim objAllSheet As Object
Dim ablSheetAll As Excel.Worksheet
Set objXLBook = GetObject("c:\test.xls")
Set objSheetAll = objXLBook.Worksheets("all")
objSheetAll.Cells("B1").Select
objSheetAll.Range("B1:b2").Select
objSheetAll.Cells(1, 2).Select
None of these worked.
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of McGillivray, Don
[IT]
Sent: Tuesday, June 19, 2007 7:13 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Quick VBA question - Selecting Cell In Excel
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
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com