Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set ting a property dynamically from a tablw

Status
Not open for further replies.

jcstrabo

Programmer
Sep 6, 2002
2
GB
Hi


I want to set the property of a chart type dynamically

GraphChart.ChartType = xl3dColumnClustered works ok

dim myChartType
myChartType =xl3dColumnClustered
GraphChart.ChartType = myChartType
works ok

but I want to store the chart type as a string in a table and recover it from a listbox
dim myChartType as string
myChartType=me!lstReport.column(3)
GraphChart.ChartType = myChartType

doesn't and I can't find a awy around it

I would be grateful for some ideas
thanks

jonathan
 
I take it you are storing "xl3dColumnClustered" as a string in the table.
xl3dColumnClustered is a defined constant which actually is equal to the value 54.
When you use
GraphChart.ChartType = xl3dColumnClustered
you are actualy using
GraphChart.ChartType = 54

When you put
myChartType=me!lstReport.column(3)
then myChartType becomes "xl3dColumnClustered" as a string, not 54.
To prove this, dim myChartType as Integer.
Now you won't be able to set
myChartType=me!lstReport.column(3)

'cos an integer cannot hold a text string.

What you can do is either store 54 in column 3 of your list, or get access to convert the string to the constant so you get:

myChartType=eval(me!lstReport.column(3))

HTH

Ben ----------------------------------------
Ben O'Hara
Home: bpo@SickOfSpam.RobotParade.co.uk
Work: bo104@SickOfSpam.westyorkshire.pnn.police.uk
(in case you've not worked it out get rid of Sick Of Spam to mail me!)
Web: ----------------------------------------
 
That's it and I feel dumb
which is great

thanks a lot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top