Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I publish a Excel chart using vba macro?

I used this vba code in the code module in Excel 2002 (SP3) to publish chart1
created from data on sheet2, but am getting the object define error:

Sub PublishToWeb()

Set oPObjs = ActiveWorkbook.PublishObjects

oPObjs.Add( _
SourceType:=xlSourceChart, _
Filename:="C:\Work.htm", _
Sheet:="Chart1", _
Source:="Chart1", _
HtmlType:=xlHtmlStatic, _
DivID:="Chart1.xls_04").Publish


End Sub

I tried to change the Source and Sheet arguments but it did not help. I
used a similer sub for the sheets and it worked fine:

Sub PublishToWeb()

Set oPObjs = ActiveWorkbook.PublishObjects
oPObjs.Add( _
SourceType:=xlSourceRange, _
Filename:="C:\Work.htm", _
Sheet:="Sheet2", _
Source:="A1:L2", _
HtmlType:=xlHtmlStatic, _
DivID:="Sheet1.xls_04").Publish

End Sub

What am I missing here? Thanks for the help.

Martin.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I publish a Excel chart using vba macro?

I recast my statements to something like these and they are now working:

With ActiveWorkbook.PublishObjects.Add(SourceType:=xlSo urceChart, _
Filename:="C:\Work.htm", Sheet:="Chart1", Source:="Chart 1", _
HtmlType:=xlHtmlStatic, DivID:="Chart1_04")
.Publish (True)
End With


"Martin N" wrote:

I used this vba code in the code module in Excel 2002 (SP3) to publish chart1
created from data on sheet2, but am getting the object define error:

Sub PublishToWeb()

Set oPObjs = ActiveWorkbook.PublishObjects

oPObjs.Add( _
SourceType:=xlSourceChart, _
Filename:="C:\Work.htm", _
Sheet:="Chart1", _
Source:="Chart1", _
HtmlType:=xlHtmlStatic, _
DivID:="Chart1.xls_04").Publish


End Sub

I tried to change the Source and Sheet arguments but it did not help. I
used a similer sub for the sheets and it worked fine:

Sub PublishToWeb()

Set oPObjs = ActiveWorkbook.PublishObjects
oPObjs.Add( _
SourceType:=xlSourceRange, _
Filename:="C:\Work.htm", _
Sheet:="Sheet2", _
Source:="A1:L2", _
HtmlType:=xlHtmlStatic, _
DivID:="Sheet1.xls_04").Publish

End Sub

What am I missing here? Thanks for the help.

Martin.

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
Excel 2007 - publish chart as htm web page file nflfan Charts and Charting in Excel 1 March 12th 10 03:05 PM
publish chart to IIS Server Hassan[_2_] Charts and Charting in Excel 0 January 28th 08 07:09 PM
Publish Excel Pivot Chart Roy[_5_] Excel Programming 0 January 7th 04 01:51 AM
Publish Macro Brian Matlack[_2_] Excel Programming 0 December 8th 03 09:23 PM
Publish Sheet AND Chart tod Excel Programming 0 November 20th 03 11:52 PM


All times are GMT +1. The time now is 01:53 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"