+ Reply to Thread
Results 1 to 2 of 2

Problems with the excel find function in vb.net

  1. #1
    pp
    Guest

    Problems with the excel find function in vb.net

    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

  2. #2
    arunkhemlai
    Guest

    RE: Problems with the excel find function in vb.net

    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


    > 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
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1