Problem changing chartype using Chartwizard in VB Express

K

Kenny Thompson

Hi,

I am trying to create a line graph using a Microsoft VB Express module.

I can get the grpah to appear with labels etc however I cannot change the
chart type to line(or any other type).
Below is the segment of code I have to display the graph:

With oBook.ActiveSheet.ChartObjects.Add _
(Left:=100, Width:=375, Top:=75, Height:=225)
.Chart.ChartWizard(Source:=oBook.ActiveSheet.Range("C4:C10"),
Gallery:=xlLine, Title:="TEST", _
ValueTitle:="# of trans", CategoryTitle:="tps")
End With


The error I get is " Name 'xlLine' is not declared.

What I dont understand is that the Title,ValueTitle,CategoryTitle properties
all work fine but I get the error on the Gallery property.

Any suggestions appreciated.
 
J

Jon Peltier

What's VB Express? Is that the lightweight dot-net thingy Microsoft released
a couple years ago?

xlLine is a built-in Excel VBA constant. If you have set a reference to
Excel's object library, this would probably not be an issue. Whatever. Go to
Excel's VB Editor. Press Ctrl+G to open the Immediate Window. In the
Immediate Window, type

?xlLine

and press Enter. VBA responds with 4. Replace the xlLine constant with the
value 4, and your code should run.

- Jon
 

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