LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default How to select cells in Excel accessed from VB6

Is it possible select a range of cells in an Excel spreadsheet under access
from a VB6 program?
The many permutations I have tried shown below fail.
Surely I should be able to Select a range of cells, because I have to do
this to sort the rows.
Thanks for kind assistance. Lamont

Private DataRange As Excel.Range
Private DataSheet As New Excel.Worksheet
Private MyWorkbook As New Excel.Workbook
Private Sub Command1_Click()
Dim strMyXLSBkSpec As String
Form1.Show
strMyXLSInSpec = "C:\DocData.xls" 'My spreadsheet
containing data about paper documents
Set MyWorkbook = GetObject(strMyXLSInSpec) 'This works to access my
Excel File
MyWorkbook.Activate 'this works
Set DataSheet = MyWorkbook.Sheets("DataSheet") 'this works
Set DataRange = DataSheet.UsedRange 'this works
Debug.Print DataRange.Rows.Count 'this works
DataSheet.Activate 'this works
'DataRange.Select 'Select method of range class failed.
'DataSheet.Range(1, 1).Select 'Method "Range" of object failed
'DataSheet.Cells(1, 1).Select 'Select method of range class failed.
'Set DataRange = Range(1, 1) 'Select method of range class failed.
'Cells.Select 'Select method of range class failed.
'DataSheet.Cells.Select 'Select method of range class failed.
'Set DataRange = Range(A1, A99) 'Select method of range class failed.
'Set DataRange = DataSheet.Range(A1, P99) 'Select method of range class
failed.
'Set DataRange = DataSheet.Range(1, 99) 'Select method of range class
failed.
End Sub
--
Lamont Phemister
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Up down arrow keys do not select cells if select locked cells unch roandrob Excel Discussion (Misc queries) 3 May 18th 09 12:48 AM
Order Cells Accessed Bill Bradshaw Excel Discussion (Misc queries) 3 September 24th 08 10:29 PM
How do I count how many times an Excel workbook has been accessed damcp Excel Discussion (Misc queries) 1 June 16th 06 01:01 AM
Excel files are 'read only' when accessed over network. gracenote Excel Discussion (Misc queries) 1 July 14th 05 02:14 PM
Excel Macro Fails Accessed Through IE Browser Edward Robichaud Excel Programming 0 September 22nd 03 11:47 PM


All times are GMT +1. The time now is 05:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"