• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Dynamic XValues/X-axis

rfestino

New Member
I have a COM+ application that opens an Excel template file that contains an embedded chart. After inserting some fixed data, the file is printed to a Postscript file. I have added macro calls in the Before_print event handler that acquires additional data from a database. Based on the additional data I dynamically change the X-axis by modifying series.Values and XValues. The VBA code works when I manually Print from within an open and visible Excel file, but the XValues are not being changed when the code is executed from COM+. I am setting the XValues via a Range variable and not an array. I get no errors when running from COM+, just no change in X-axis. The chart has both a line and column data series. Using Excel 2003 SP3.
 
I have solved my problem but I think Excel may be a little quirky.

I defined named ranges and assisgned my data series' values to the named ranges rather than having actual cell references. Instead of changing the series values and xvalues cell references based on dynamic data, I changed the named range RefersTo value.


I cannot explain why my original plan failed when running Excel from COM+ app but worked when running Excel from desktop.
 
Back
Top