Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Aug 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Detect wether Excel or OO Calc open a workbook (10.0)

    Is ther any mean to detect wether a workbook is opened by Excel or Open Office Calc ?

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Detect wether Excel or OO Calc open a workbook (10.0)

    The following VBA fucntion should determine if the Workbook (WorkbookName) is open by Excel. <pre>Function IsWorkbookOpen(WorkbookName As String) As Boolean
    On Error Resume Next
    IsWorkbookOpen = Len((Workbooks(WorkbookName).Name))
    On Error GoTo 0
    End Function</pre>


    If this returns false and you know the file is open then perhaps you can deduce that is opened by Open Office Calc.

    Andrew C

  3. #3
    New Lounger
    Join Date
    Aug 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Detect wether Excel or OO Calc open a workbook (10.0)

    Thanks, this works fine with Excel and OpenOffice Calc !

    I have now refined the code in order to have no workbook name to specify :

    Function IsExcel() As Boolean

    On Error Resume Next
    IsExcel = Len((Workbooks(ThisWorkbook.Name).Name))
    On Error GoTo 0

    End Function

    I needed this function to select "!" or "." to reference a cell in another worksheet using the INDIRECT function : I have now a truly portable workbook between home (Excel) and office (Open Office, sorry Bill) !

  4. #4
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Detect wether Excel or OO Calc open a workbook (10.0)

    I don't understand what you are after.

    If you test the workbook with the code in it (thisworkbook), to see if it is open, it should always be open when the code runs.

    What are your trying to test?

    Steve

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Detect wether Excel or OO Calc open a workbook (10.0)

    I think asole meant to report that the problem has been solved.

  6. #6
    New Lounger
    Join Date
    Aug 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Detect wether Excel or OO Calc open a workbook (10.0)

    When the worbook is open by OpenOffice, this function don't work, so I know that I must reference a cell in another worksheet with "." (a dot)
    When the worbook is open by OpenOffice, this function always works, so I know that I must reference a cell in another worksheet with "!"
    Depending of this result I can select the right separator in my INDIRECT function to make the whole stuff working wether I use Excel or OpenOffice

Posting Permissions

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