Hale, Jim
Jim.Hale at FleetPride.com
Wed Jun 20 09:06:09 CDT 2007
Something like this should work Jim Hale Dim appexcel As Excel.Application Set appexcel = New Excel.Application With appExcel .Sheets("sales").Select .Cells(2, 1).Select End With -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Skolits Sent: Tuesday, June 19, 2007 6:26 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Quick VBA question - Selecting Cell In Excel 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 -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com *********************************************************************** The information transmitted is intended solely for the individual or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this email in error please contact the sender and delete the material from any computer. As a recipient of this email, you are responsible for screening its contents and the contents of any attachments for the presence of viruses. No liability is accepted for any damages caused by any virus transmitted by this email.