Automation from Access to Excel

G

GailFialho

I do a lot of programming within Access to export data and programmatically
generate charts in Excel.
Usually I can just record what I want in Excel and transfer the code(with
some syntax changes) right into my Access module.
Right now I’m struggling with inserting a text box with specific data into
the upper left corner of the chart that I have just created.

strData = “3 Month RunRate: 26198″ & Chr(10) & “3 Month Forecast Average:
26198″ & Chr(10) & 6 Month RunRate: 25844″ & Chr(10) & 6 Month Forecast
Average: 25844″

Here’s what WONâ€T work:
with xlchart.chart.Shapes.AddTextbox(msoTextOrientationHorizontal, _
25, 20, 160, 70).Select
With xlChart.Chart.Shapes(â€Text Box 1″).Characters.Text = strData
With Selection.Characters(Start:=1, Length:=110).Font
..Name = “Arialâ€
..FontStyle = “Regularâ€
..Bold = True
..Size = 10
End With
End With
End With

Thank you in advance,
Gail
 
K

Ken Snell \(MVP\)

This line of code looks very wrong:

With xlChart.Chart.Shapes("Text Box 1?).Characters.Text = strData


A With statement is not used to set a value to another variable.....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top