2008/2/4, Jonathan Kaye <[EMAIL PROTECTED]>: > > OOo macros are driving me crazy! I'm running OOo 2.3.1 on a linux (Debian > Lenny) box. The behaviour of macros is, to say the least flakey. I have a > macro called "map" thanks to Anthony Chilco of this list. Here's the code: > [code] > public function map(ProcessString) as string > dim Position as integer > dim Index as integer > dim Ch as String > const TargetString = "aãbdefghiœjk«lmnoŒprstèu¡vwx|º!Øãôûn1234" > const ReplaceString = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcd" > for Index = 1 to len(ProcessString) 'Check each character of the > string to process > Ch = mid(ProcessString,Index,1) 'Extract one character > Position = instr(TargetString,Ch) 'See if it's in the list of > characters to be replaced > 'Position = instr(1,TargetString,Ch,0) 'Use this line for > case-sensitive search > If Position<>0 then 'If it is, insert it into the > process string > ProcessString=mid(ProcessString,1,Index-1)+ > mid(ReplaceString,Position,1)+ mid(ProcessString,Index+1,999) > end if > next Index > Map=ProcessString > end function > [/code] > This code is in both Module1 of My Macros - Standard - Module1 and ndp - > Standard - Module1 (ndp being the name of the document is question) > I want to set up a column in a spreadsheet containing 18 fields. So in > cell > T1 I enter the following: =map(b1) and I get the following behaviour: > a window opens saying OO Calc found an error in the formula entered > it asks if I want to accept correction ='map'*(B2) if I accept, it returns > 0 > if I don't accept it returns error 509. > > Now I open I new sheet and copy Column b of the first sheet onto column b > of > the new sheet. I enter the same formula =map(b2) into, say, cell T2 and it > works perfectly. > > This is driving me crazy. Anyone who helps gets mentioned in my will :-) > Cheers, > Jonathan > I tried your macro and I didn't get the problems you described. It seemed to work perfectly. Maybe I need your whole document to evaluate what's going on.
By the way, I think it is a better idea to ask this kind of questions at the [EMAIL PROTECTED] mailing list. There are usually more macro programmers on that list that can help you better. Johnny Rosenberg
