+ Reply to Thread
Results 1 to 3 of 3

Userdefined Function and recalculatiing XL 2k3

  1. #1
    Thomas Weber
    Guest

    Userdefined Function and recalculatiing XL 2k3

    Hi all,
    I am using something like that:

    WorkBook A has the Document Property "Title" set to 'A'.
    WorkBook B has the Document Property "Title" set to 'B'.

    In each Workbook (A and B) is a VBA-function:

    Function myGetBulitInProp(ByVal PropName As String)
    myGetBuiltInProp=Null
    On Error Resume Next
    For Each prop in ActiveWorkbook.BuiltInDocumentProperties
    If (prop.name = PropName) Then
    myGetBuiltInProp=prop.Value
    End If
    Next
    End Function

    i.e. Cell A1 in Workbooks A and B contains the formula:
    =myGetBuiltInProp("Title")
    This results in the correct values for each Workbook.

    The Problem:
    Opening both WorkBook A and WorkBook B results in (displayed) Value 'B'
    in Cell A1 in both WorkBooks (Document Properties are unchanged and
    still correct).
    Doing so with more than two Workbooks sets all the values to the one of
    the last opened WorkBook.

    I'm running Excel 2003 SP2 (Built 11.6560.6568) and yes, automatic
    recalculation is activated.
    Any ideas?

    Thanx in advance

    Thomas

  2. #2
    Bob Phillips
    Guest

    Re: Userdefined Function and recalculatiing XL 2k3

    Use ThisWorkbook, not Activeworkbook.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Thomas Weber" <thomas.weber@mechatronic.de> wrote in message
    news:dm4c4b$k8k$1@ulysses.news.tiscali.de...
    > Hi all,
    > I am using something like that:
    >
    > WorkBook A has the Document Property "Title" set to 'A'.
    > WorkBook B has the Document Property "Title" set to 'B'.
    >
    > In each Workbook (A and B) is a VBA-function:
    >
    > Function myGetBulitInProp(ByVal PropName As String)
    > myGetBuiltInProp=Null
    > On Error Resume Next
    > For Each prop in ActiveWorkbook.BuiltInDocumentProperties
    > If (prop.name = PropName) Then
    > myGetBuiltInProp=prop.Value
    > End If
    > Next
    > End Function
    >
    > i.e. Cell A1 in Workbooks A and B contains the formula:
    > =myGetBuiltInProp("Title")
    > This results in the correct values for each Workbook.
    >
    > The Problem:
    > Opening both WorkBook A and WorkBook B results in (displayed) Value 'B'
    > in Cell A1 in both WorkBooks (Document Properties are unchanged and
    > still correct).
    > Doing so with more than two Workbooks sets all the values to the one of
    > the last opened WorkBook.
    >
    > I'm running Excel 2003 SP2 (Built 11.6560.6568) and yes, automatic
    > recalculation is activated.
    > Any ideas?
    >
    > Thanx in advance
    >
    > Thomas




  3. #3
    Thomas Weber
    Guest

    Re: Userdefined Function and recalculatiing XL 2k3

    Bob Phillips schrieb:

    >Use ThisWorkbook, not Activeworkbook.
    >
    >
    >

    Many thanks. It works.

    Thomas

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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