Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel replace function
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01096827
Message ID:
01101853
Vues:
16
>>>I don't know, I get them by simple using MsgBox(xlByRows) in Excel Macro Editor :o)
>>>I'am just working for search and fromat row when found. When I finish, I'll let you know. After that I'll try Cetin's code. I am sure it is working somehow :o)
>>
>>I don't know, this conditional formatting was not saved for me. E.g. when I made Excel visible I saw the formatting for that column, but after I closed the file the formatting was gone. The REPLACE works fine, e.g. it changes formatting of the TOTALS word just fine. May be it's an easier approach?
>
>You must save the file before you close it
>
>Here what I invent :o)
>
>#define xlLastCell    11
>#define xlPart         2
>#define xlByRows       1
>#define xlValues       -4163
>LOCAL oExcel AS Excel.Application
>oExcel = CREATEOBJECT([Excel.Application])
>oExcel.Visible = .t.
>oExcel.Workbooks.Open([d:\book1.xls])
>oExcel.Range([A1]).Select
>LOCAL oFind, oFirstAddress
>WITH oExcel.Range([A1],oExcel.Selection.SpecialCells(xlLastCell))
>    oFind = .Find([Total],,xlValues)
>    IF NOT ISNULL(oFind)
>       oFirstAddress = oFind.Address
>       DO WHILE NOT ISNULL(oFind)
>          ? oFind.Address
>          oFind = .FindNext(oFind)
>          lnRow = INT(VAL(SUBSTR(oFind.Address,RAT([$],oFind.Address)+1)))
>          oExcel.Rows(lnRow).Select
>          WITH oExcel.Selection
>               .Font.Bold = .t.
>          ENDWITH
>          IF oFind.Address == oFirstAddress
>             EXIT
>          ENDIF
>       ENDDO
>    ENDIF
>ENDWITH
>oExcel.Save([d:\books.xls])
>
Very nice <g> The only problem is that it's now prompting me to save and saying about different format. How can I supress that?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform