Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xlSheet.get_range not there 1

Status
Not open for further replies.

EwS

Programmer
Dec 30, 2002
398
US
I'm trying to use the get_range method on an Excel sheet, but when I type 'xlSheet.' I don't see the method in the drop-down. I see Cells, Name, etc. I don't know why.
This is my code:
Code:
Dim workbook As Excel.Workbook = workbooks.Add(Excel.XlWBATemplate.xlWBATWorksheet)
Dim xlSheet As Excel.Worksheet = CType(workbook.ActiveSheet, Excel.Worksheet)
xlSheet.get_Range(.......) 'I CAN'T DO THIS
Thanks for any help!
 
I do see it in my C# project, but not VB project. According to documentation it should be available for VB as well. I don't know what I'm doing wrong.
 
I'm not 100% sure, but I've never seen many underscores in a method name. Have you tried GetRange()?

--Rob
 
I'm positive it's get_range (with the underscore). I don't see any method starting with a "g".
 
Do you have references to excel and interop namespaces?

And I may be mistaken but I think you need to use get_range to assign a collection of cells to a range object.

Something like

Code:
Dim myRange as Range = xlSheet.get_Range("C5")

Hope this helps,

Alex

[small]----signature below----[/small]
I don't do any programming whatsoever

Ignorance of certain subjects is a great part of wisdom
 
Yes, I have the same references as in my C# project (where it works). Even if I assign a range like this:
Code:
Dim myRange as Range = xlSheet.get_Range("C5")
[\code]
I cannot select get_Range from the drop-down.
 
Ok, I did a little digging and the get_Range method is not available in VB.net

Instead try something like this:

Code:
Dim myRange as Range = xlSheet.Range("A6")
myRange.Value = "Some Value"

Hope this helps,

Alex

[small]----signature below----[/small]
I don't do any programming whatsoever

Ignorance of certain subjects is a great part of wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top