Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Simple Excel Automation
Message
De
24/10/2002 03:24:47
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00714397
Message ID:
00714692
Vues:
19
#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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform