Consulting

Results 1 to 3 of 3

Thread: Assign Formula to Chart Sheet Text Box (migrating from Excel 2003 to Excel 2007)

  1. #1

    Question Assign Formula to Chart Sheet Text Box (migrating from Excel 2003 to Excel 2007)

    Hi,

    I have some code (at the end of this message) that worked with Excel 2003 to assign a formula to a text box on a chart sheet. The code does not work with Excel 2007 and from the new Excel Object Model...I cannot find references to formulas with shape objects.

    The overall purpose of my code is to allow the user to automatically generate a number of chart sheets with scatter plots and formatted title blocks. The title blocks contain information on the figure number, figure title, project, date, etc that is ready to be included in a report. The text boxes on the chart sheets are linked to cells on a "Figure Information" worksheet allowing the user to enter and update information for all charts from one worksheet.

    [vba]
    'Figure Number
    linkform(1) = "'" & "Figure Information" & "'" & "!$"
    linkform(2) = NumbertoLetter(figinfo + 1)
    linkform(3) = "$5"
    ActiveChart.Shapes("Text Box 2").Select
    tbzorder = ActiveChart.Shapes("Text Box 2").ZOrderPosition
    finallink = Join(linkform, "")
    ActiveChart.TextBoxes(tbzorder).Formula = finallink

    [/vba]

    Any suggestions? Thanks!

    greenchile
    Last edited by greenchile; 02-09-2008 at 07:47 PM.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Can you post a sample workbook to save have us having to try and simulate what you have done?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    MS Excel MVP VBAX Tutor
    Joined
    Mar 2005
    Posts
    246
    Location
    There is no "=" in your formula.
    No need to reference by ZOrder, in fact, that may not be reliable.

    Try this syntax:

    ActiveChart.TextBoxes("Text Box 2").Formula = "=Sheet1!$B$3"
    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    Peltier Technical Services
    Tutorials and Custom Solutions
    http://PeltierTech.com
    _______

Posting Permissions

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