Excel TOleAuto - Find & replace function ...

Post Reply
User avatar
Rimantas
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Excel TOleAuto - Find & replace function ...

Post by Rimantas »

Hi !

In workplace changed mine PC and with a new Office 2007 . Sorry , but it seems that CHM files of VBAXL10 is empty ( 2b ) . So I can't to view how Find & Replace function can work . It's needful for me that in TExcelsScript class . Maybe you are using something ? Any sample ?

With best regards and thanks in advance ! Rimantas
Rimantas U.
Gale FORd
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston
Contact:

Post by Gale FORd »

Don't forget, you can record a macro in Excel then perform your actions and then go back and look at the commands it created.
User avatar
Rimantas
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Post by Rimantas »

Gale FORd wrote:Don't forget, you can record a macro in Excel then perform your actions and then go back and look at the commands it created.
A good advice ! :) Thanks ! I'll look into that . But maybe other person have experience with that ? Because transfer from VBA to FWH syntax is complicated and it tooks some hours tries . So any help it will accelearte process ... :)

I looked into macro - here is a piece of source

Code: Select all

    Selection.Replace What:="QWE", Replacement:="555", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False

Of course , I'll try to convert that to FWH . But I'll thankfull for any help , how to do that .

With best regards ! Rimantas
Rimantas U.
User avatar
Rimantas
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Post by Rimantas »

Rimantas wrote: I looked into macro - here is a piece of source

Code: Select all

    Selection.Replace What:="QWE", Replacement:="555", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False

Of course , I'll try to convert that to FWH . But I'll thankfull for any help , how to do that .
After some research I created new method for TExcelScript class . Here is a code :

Code: Select all

METHOD FReplace( nCol, cWhat, cReplacement, nLookAt, nSearchOrder, lMatchCase, lMatchByte, cSearchFormat, cReplaceFormat ) CLASS TExcels
   Default nCol         := ::oCell:Column
   Default nLookAt      := 1 // xlWhole = 1 , xlPart = 2
   Default nSearchOrder := 2 // xlByColumns = 2 , xlByRows = 1
   Default lMatchCase   := .f.
   
   ::oSheet:Columns( nCol ).Replace( cWhat, cReplacement, nLookAt, nSearchOrder, lMatchCase )
return( NIL )
With best regards ! Rimantas
Rimantas U.
Post Reply