Excel chart to HTML to website

jandhi

New Member
Joined
Apr 18, 2012
Messages
3
I am running a system that uploads data periodically to an excel chart. I want to publish this chart onto a website and have it automatically be updated to the website at the same rate that the data is updated in the excel file. I have started by using this VBA macro:
<o:p></o:p>
<o:p>Sub Auto_Open()<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
<o:p> </o:p>ThisWorkbook.PublishObjects.Add(xlsSourceChart, _<o:p></o:p>
"C:\Documents and Settings\jdallas\Desktop\Testing\chart.html" _<o:p></o:p>
, "Sheet1", "Chart 2", xlHtmlStatic, "DevXSample_16365", _<o:p></o:p>
"Graph1").Publish (True)<o:p></o:p>
Application.OnTime Now + TimeValue("00:00:30"), _<o:p></o:p>
"Auto_Open"<o:p></o:p>
End Sub<o:p></o:p>
</o:p>
I have 2 questions:
1. I am trying to publish a specific chart to an HTML file, but no matter what I put into the fields for "Sheet1" or "Chart2", excel always publishes the entire workbook. How can I only publish an HTML file of the chart I want and nothing else?
2. How can I automatically have this chart html file updated to a website?

Thanks so much.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
1. Ya, I think I like the images much better. I simply export all my images as .png's and have an html page that uses the images.
Here's the vba code:

Sub ExportChart1()
With Workbooks("PowerPer.xlsm")
.Worksheets("Power Per Day").ChartObjects("Chart 1").Chart. _
Export ("C:\Documents and Settings\jdallas\Desktop\Online _ Folder\meter1_files\perDay.png")

.Worksheets("Power Per week").ChartObjects("Chart 2").Chart. _
Export ("C:\Documents and _ Settings\jdallas\Desktop\Online Folder\meter1_files\perWeek.png")
End With
Application.OnTime Now + TimeValue("00:00:30"), _
"ExportChart1"

End Sub

2. Ok, I'll keep looking those things up. Thanks for your help.
 
Upvote 0
You're updating every 30 seconds? What's the latency for Excel to get the data, export the chart, and upload the image file?

I suggest you look for a web technology to handle this.
 
Upvote 0
It just takes a few seconds, it ran just fine. And 30 seconds was just so I could test run things quickly, in practice it wont update that regularly.

Alright, that's what I've been working on all day. I'm trying personal web servers but I think my company's firewall is blocking that from working for anyone outside the company's network, so I think I'll have to try something else. Thanks.
 
Upvote 0

Forum statistics

Threads
1,214,805
Messages
6,121,656
Members
449,045
Latest member
Marcus05

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top