Programatically Export Excel Chart to Graphic in SharePoint

T

Travis

I have been using the following VBA command to export Excel charts to
graphics. This works perfectly for local or network storage.

Worksheets(1).ChartObjects(1).Chart.Export
Filename:="Filepath\Filename.gif", filtername:="GIF"

When I modify to save to SharePoint site as follows it returns Error
-2146697210 (800c0006).

Worksheets(1).ChartObjects(1).Chart.Export
Filename:="http://ms-proto/TeamFolder/Shared Documents/Filename.gif",
filtername:="GIF"

I have tried the application.workbooks.saveas command to save the workbook,
and that does work to save into sharepoint. Any suggestions?
 
T

Travis

I hadn't tried it before, but just tried it now. Same result. Gives me an
automation error and stops execution of the code.
 
T

Travis

SharePoint does in fact support drive mapping and I have done that to correct
the issue for now. I was just hoping to have a solution that did not require
each user to map the location to the same drive letter.

Thanks for your help!
 
T

Tim Williams

Try the using UNC path without mapping a drive. Should still work...

Worksheets(1).ChartObjects(1).Chart.Export _
Filename:="\\sharepointserver\subfolder\subfolder\yourlocn\filename.gif",
_
filtername:="GIF"


Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top