Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA error in charting function. Help!


Hi all,

My code has been running fine up to this point, so hopefully someone
can help me out. I am trying to create several worksheets in a workbook
to be populated later in the program, and then proceed to create charts.
Previously, I had only created one extra worksheet prior to making
charts, but as soon as I add a second blank worksheet, I get a weird
error in my charting sub.

Here is the code from the calling function:

Application.StatusBar = "Creating output worksheets"

Set ws = wb.Worksheets.Add
ws.Name = "Output"
Set outputPage = ws.Cells

Set ws1 = wb.Worksheets.Add
ws1.Name = "DataSet 1"
Set page1 = ws1.Cells

Call AddCharts(wb, outputPage, page1)

And here is the code from the charting function:

Set case1 = wb.Charts.Add
With case1
ChartType = xlXYScatterLinesNoMarkers
Location Whe=xlLocationAsNewSheet, Name:="(1)V&I
Graph"
HasTitle = True

VBA says that there is an error in the .HasTitle line and will not
allow me to proceed until .HasTitle is either commented out of made
false. What gives? Any help would be greatly appreciated. Thanks!


--
3PhaseMacroMan
------------------------------------------------------------------------
3PhaseMacroMan's Profile: http://www.excelforum.com/member.php...o&userid=29945
View this thread: http://www.excelforum.com/showthread...hreadid=496433

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default VBA error in charting function. Help!

I have run across this before, I think: I don't think you can set HasTitle =
True until the chart has at least one data series. Try specifying your data
range first (e.g. SetSourceData, or create a seriescollection) and then set
HasTitle=True.

Tested on win2000/Excel2000; using your code got same error but doing
..SetSourceData before .HasTitle got it to work OK.
--
- K Dales


"3PhaseMacroMan" wrote:


Hi all,

My code has been running fine up to this point, so hopefully someone
can help me out. I am trying to create several worksheets in a workbook
to be populated later in the program, and then proceed to create charts.
Previously, I had only created one extra worksheet prior to making
charts, but as soon as I add a second blank worksheet, I get a weird
error in my charting sub.

Here is the code from the calling function:

Application.StatusBar = "Creating output worksheets"

Set ws = wb.Worksheets.Add
ws.Name = "Output"
Set outputPage = ws.Cells

Set ws1 = wb.Worksheets.Add
ws1.Name = "DataSet 1"
Set page1 = ws1.Cells

Call AddCharts(wb, outputPage, page1)

And here is the code from the charting function:

Set case1 = wb.Charts.Add
With case1
ChartType = xlXYScatterLinesNoMarkers
Location Whe=xlLocationAsNewSheet, Name:="(1)V&I
Graph"
HasTitle = True

VBA says that there is an error in the .HasTitle line and will not
allow me to proceed until .HasTitle is either commented out of made
false. What gives? Any help would be greatly appreciated. Thanks!


--
3PhaseMacroMan
------------------------------------------------------------------------
3PhaseMacroMan's Profile: http://www.excelforum.com/member.php...o&userid=29945
View this thread: http://www.excelforum.com/showthread...hreadid=496433


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Labels, Error Bars, and Dynamic Charting Rcarper Charts and Charting in Excel 1 August 28th 09 04:24 AM
CHARTING CODE ERROR Jase Excel Discussion (Misc queries) 6 April 11th 08 07:32 PM
charting and vloookup function LB[_2_] Charts and Charting in Excel 0 March 16th 07 05:40 PM
Charting error in Excel2003 Julie Charts and Charting in Excel 1 October 19th 05 11:42 PM
Charting - Cells and Range - Error 1004 vbaprog Excel Programming 2 May 4th 05 08:05 AM


All times are GMT +1. The time now is 06:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"