+ Reply to Thread
Results 1 to 7 of 7

Detect relative reference style letters - different languages

  1. #1
    Registered User
    Join Date
    11-13-2013
    Location
    Poland
    MS-Off Ver
    Excel 22000
    Posts
    4

    Detect relative reference style letters - different languages

    I write an application in Delphi which also exports results to Excel using OleObjects.
    It exports formulas using relative referencing for example: '=RC[-1]*RC[-2]'.
    It doesn't work for example with Polish version of Excel 2000 because the formula
    letters of row and column should be W and K, so formula looks '=WK[-1]*WK[-2]'.

    I would like to know how to detect reference style letters if I should use RC or WK
    or anything else depending on version and language of installed Excel.

    Is there any function to detect those letters for referencing?

  2. #2
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Detect relative reference style letters - different languages

    What is your code to load the formulas? If it uses FormulaR1C1 the RC references would be valid I think because that property uses American formats.

  3. #3
    Registered User
    Join Date
    11-13-2013
    Location
    Poland
    MS-Off Ver
    Excel 22000
    Posts
    4

    Re: Detect relative reference style letters - different languages

    I used Value property and FormulaR1C1 and both doesn't work for Excel 2000 Polish version. With Excel 2013 it works flawlessly.
    The export hangs at moment where the stringgrid have a relative referencig formula string.
    The example code I used you can find here (I used example With OLE Automation ): http://www.swissdelphicenter.ch/torr...ode.php?id=379
    Last edited by thwei11; 11-13-2013 at 10:58 AM.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Detect relative reference style letters - different languages

    What are you using for the separators in the formulas?
    If posting code please use code tags, see here.

  5. #5
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Detect relative reference style letters - different languages

    What is returned if you call
    Please Login or Register  to view this content.
    where data is your formula string? You can use XLApp.International(6) to obtain the local equivalent of R and XLApp.International(7) to obtain the local equivalent of C but you must then parse the formula which may not be easy if your formulas are more complicated than your example.

  6. #6
    Registered User
    Join Date
    11-13-2013
    Location
    Poland
    MS-Off Ver
    Excel 22000
    Posts
    4

    Re: Detect relative reference style letters - different languages

    Can't check already what is returned from given call because I need to go to other computer to compile application and run it and see on another.
    Anyway those international values are what I exactly needed and I think they will fix my problem.

    I made a comparison of on which settings Execel 2000 and 2013 work. I've only set XlApp.RefernceStyle to xlR1C1.

    For Excel 2000 PL it is:
    Formula string type Method Value Method FormulaR1C1
    RC not working not working
    WK working working

    For Excel 2013 PL:
    Formula string type Method Value Method FormulaR1C1
    RC working working
    WK not working not working

  7. #7
    Registered User
    Join Date
    11-13-2013
    Location
    Poland
    MS-Off Ver
    Excel 22000
    Posts
    4

    Re: Detect relative reference style letters - different languages

    Quote Originally Posted by Izandol View Post
    You can use XLApp.International(6) to obtain the local equivalent of R and XLApp.International(7) to obtain the local equivalent of C but you must then parse the formula which may not be easy if your formulas are more complicated than your example.
    This really fixed my problem but had to use brackets instead parentheses: XLApp.International[6] and XLApp.International[7].

    Thanks.

    Edit:
    Don't know what happened but with Excel 2013 it worked for a while and stopped after some testing. Now even if XLApp.International returns 'W' and 'K' for formulas I need to use 'R' and 'C' for referencing. Posted procedure gives:

    Formula:='=WK[-2]*WK[-1]';
    Formula2:='=RC[-2]*RC[-1]';
    S1:=Excel.ConvertFormula(Formula, -4150, 1); // gives '=XFC1*XFD1'
    S2:=Excel.ConvertFormula(Formula2, -4150, 1); // gives an exception

    Don't know how to fix it.

    Edit 2:

    Already found the solution. There are plenty of properties starting with Formula, just needed to use FormulaR1C1Local so it will always accept localized formula notation.
    Last edited by thwei11; 11-13-2013 at 11:42 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Looking for a way to find and replace just letters in a regex style manner
    By Wegener in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-13-2013, 02:20 PM
  2. Replies: 5
    Last Post: 09-21-2012, 02:08 PM
  3. change from relative reference to absolute reference
    By ronlau123 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-13-2011, 04:57 AM
  4. Replies: 0
    Last Post: 11-15-2007, 02:35 AM
  5. absolute cell reference in R1C1 reference style
    By Prorocentrum in forum Excel General
    Replies: 1
    Last Post: 06-18-2007, 04:59 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1