|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problems with the excel find function in vb.netI have copied this code from Excel VBA, to use in a VB.net application:
Dim r as Excel.Range r=Cells.Find(What:="02/01/2001 22:00:00", After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False) But in VB.net, the editor doesn’t recognise de following constants: ActiveCell, xlFormulas, xlPart, xlByRows. Do you have any ideas? Thanks, Paulo Praça Imports Excel = Microsoft.Office.Interop.Excel
Sub Main() Dim r As Excel.Range r = Cells.Find( _ What:="02/01/2001 22:00:00", _ , _ <-- Can leave it blank here LookIn:=Excel.XlFindLookIn.xlFormulas, _ LookAt:=Excel.XlLookAt.xlPart, _ SearchOrder:=Excel.XlSearchOrder.xlByRows, _ SearchDirection:=Excel.XlSearchDirection.xlNext, _ MatchCase:=False, _ SearchFormat:=False) ..... More info --> "http://msdn.microsoft.com/office/understanding/vsto/default.aspx?pull=/library/en-us/odc_vsto2003_ta/html/ExcelObj.asp" HTH, arunkhemlai Show quoteHide quote > I have copied this code from Excel VBA, to use in a VB.net application: > > Dim r as Excel.Range > > r=Cells.Find(What:="02/01/2001 22:00:00", After:=ActiveCell, > LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, > SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False) > > But in VB.net, the editor doesn’t recognise de following constants: > ActiveCell, xlFormulas, xlPart, xlByRows. > > Do you have any ideas? > > Thanks, > Paulo Praça > Many thanks for your answer. I had a problem with the first line of
code: Imports Excel = Microsoft.Office.Interop.Excel. I have this answer: Namespace or type ‘Excel’ for the imports ‘Microsoft.Office.Interop.Excel’ cannot be found. In the begin of my module I have these imports: Imports Microsoft.Office.Core Imports System.Data.OleDb Thanks, Paulo Praça *** Sent via Developersdex http://www.developersdex.com ***
DataReader in Excel (Better Post than the last)
Update for VS .NET 2003? Help with some code? for loop ending condition Compiler errors due to temp file inconsistencies ?? Remove items from listbox How to use Regex to Parse this String newbie question regarding repeater control Optimization i can't get number... |
|||||||||||||||||||||||