Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simple Excel Automation
Message
From
24/10/2002 03:24:47
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00714397
Message ID:
00714692
Views:
18
#Define xlValues  -4163

#Define xlWhole  1
#Define xlPart  2

lcSearchValue = 'find me'
lcXLS = 'c:\blah blah\myexcelfile.xls'
oExcel = Createobject("Excel.Application")
With oExcel
  .Workbooks.Open(lcXLS)
  With .ActiveWorkbook.ActiveSheet
    loRange = .Range('A:A').Find(lcSearchValue,,xlValues,xlPart)
    If !Isnull(loRange)
      ? .Range(Stuff(loRange.Address(),1,3,'$C$')).Cells(1,1).Value
    Else
      ? 'Not found'
    Endif
  ENDWITH
  .quit
Endwith
With xlPart you're searching values that's contained (ie: like '%find me%'. For exact match use xlWhole. Also Find has parameter for case sensitivity (default case insensitive).
Cetin

>I know Cetin, the problem is this excel file gets updated quite frequently.
>
>>Jaime,
>>There are numerous ways to do that with or w/o automation. I think import command would be one of the fastest.
>>Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform