-
Oct 25th, 2010, 09:11 AM
#1
Thread Starter
Addicted Member
[RESOLVED] excel method find in VB2010
hi all,
this is my first topic and I hope to do not some mistake.
I decided to to convert my excel macro in a exe file using visual studio 2010.
In excel macro method find is present like this:
findRNC_row = xl.cells.Find(RNCid, SearchOrder:=xlByColumns, searchDirection:=xlNext).Row
where xl is so defined:
dim xl as object
xl=createobject("excel.application")
VB does not recognize SearchOrder:=xlByColumns and SearchDirection:=xlNext
is it possible to use excel method find in vb2010?
if yes, can someone help me please?
thanks in advanced
gio
-
Oct 25th, 2010, 10:16 AM
#2
Re: excel method find in VB2010
Change that to
Code:
xl.Cells.Find("*", missing, Excel.XlFindLookIn.xlValues, missing, Excel.XlSearchOrder.xlByColumns, Excel.XlSearchDirection.xlPrevious)
Please mark you thread resolved using the Thread Tools as shown
-
Oct 25th, 2010, 11:13 AM
#3
Thread Starter
Addicted Member
Re: excel method find in VB2010
Originally Posted by danasegarane
Change that to
Code:
xl.Cells.Find("*", missing, Excel.XlFindLookIn.xlValues, missing, Excel.XlSearchOrder.xlByColumns, Excel.XlSearchDirection.xlPrevious)
hi danasegarane,
thanks for your reply.
VB2010 does not recognize Excel object.
How can I define it?
BR,
gio
-
Oct 25th, 2010, 11:23 AM
#4
Re: excel method find in VB2010
Did you add reference to Excel Object using Add Reference Dialog box ?
Please mark you thread resolved using the Thread Tools as shown
-
Oct 25th, 2010, 11:39 AM
#5
Thread Starter
Addicted Member
Re: excel method find in VB2010
Originally Posted by danasegarane
Did you add reference to Excel Object using Add Reference Dialog box ?
no I didn't.
But now on project I selected "Add references"->"Browse" and then I selected Excel file.
Is it correct?
Even if in this way Vs2010 does not yet recognize it.
EDIT
if I insert Microsoft.Office.Interop.Excel , it works
CAn I rename Microsoft.Office.Interop.Excel with Excel?
Last edited by giodepa; Oct 25th, 2010 at 11:45 AM.
-
Oct 25th, 2010, 01:37 PM
#6
Re: excel method find in VB2010
Use Imports Statement in the Top of the Page
Code:
Imports Microsoft.Office.Interop
Please mark you thread resolved using the Thread Tools as shown
-
Oct 25th, 2010, 01:58 PM
#7
Thread Starter
Addicted Member
Re: excel method find in VB2010
Originally Posted by danasegarane
Use Imports Statement in the Top of the Page
Code:
Imports Microsoft.Office.Interop
great dana it works!!!
Anyway "missing" is not recognized. Why?
I have to write
Code:
xl.Cells.Find("*", missing, Excel.XlFindLookIn.xlValues,
or
Code:
xl.Cells.Find("*", , Excel.XlFindLookIn.xlValues,
thanks for your patience
-
Oct 26th, 2010, 01:36 AM
#8
Re: excel method find in VB2010
Please mark you thread resolved using the Thread Tools as shown
-
Oct 26th, 2010, 02:34 AM
#9
Thread Starter
Addicted Member
Re: excel method find in VB2010
Originally Posted by danasegarane
hi gana, it does not work
-
Oct 26th, 2010, 10:25 AM
#10
Thread Starter
Addicted Member
Re: excel method find in VB2010
Originally Posted by giodepa
hi dana, it does not work
Hi dana,
I solved it.
Correct syntax is:
Code:
xl.Cells.Find("*", , Excel.XlFindLookIn.xlValues, , Excel.XlSearchOrder.xlByColumns, Excel.XlSearchDirection.xlPrevious)
Missing is not to be writed.
gio
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|