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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

jandhi

New Member
Joined
Apr 18, 2012
Messages
3
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.
 

Jon Peltier

MrExcel MVP
Joined
May 14, 2003
Messages
5,258
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
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.
 

jandhi

New Member
Joined
Apr 18, 2012
Messages
3
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.
 

Forum statistics

Threads
1,176,276
Messages
5,902,295
Members
434,959
Latest member
etb1025

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
Top