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.
|