The export chart method can be problematic with the Filtername argument
included, but it seems that's not the cause of your problem. Your code looks
OK but I can't test saving to a server. BTW, you don't need to select the
chart, eg
Sheets("Graphs").ChartObjects("Grafiek 2").Chart.Export sFileName
Try exporting to your local drive first, then copy or upload the file to
your server.
If that works, and you particularly want to save as a jpg try that as well.
But even with .jpg you can probably drop the FilterName argument. FWIW
charts are generally better suited to gif's rather than jpg's, unless they
include particular images.
Regards,
Peter T
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I tried it with the following code but still no succes. Any more
> suggestions or is my code faulty?
>
>
> <u>Quote of error message:</u>
> Error 1004 during execution
> Export of object_chart failes
>
> <u>VBA Code used:</u>
> Sub ExportChart2JPG()
>
> Sheets("Graphs").Select
> ActiveSheet.ChartObjects("Grafiek 2").Activate
> ActiveChart.ChartArea.Select
> ActiveChart.Export Filename:="http://ehvtintra/ehv-hog/Energy%20and
> %20Emissions%20SSI/Excel/Grafiek2.gif"
>
> End Sub
>
>
>
>
>
>
>
>
> Peter T schreef:
> > Try exporting it as a .gif and don't include the 'FilterName' argument
at
> > all, or FilterName as an empty string, "".
> >
> > Regards,
> > Peter T
> >
> > <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Morning,
> > >
> > > I am building an Excel workbook to automaticly update my website by
> > > clicking a macro. For publishing of my data i have a good working VBA
> > > code but the related graphs to this data should be published as well.
> > > So, in order to do that i wanted to add this code (see below).
> > > This VBA code works perfectly in a local directory environment (C / D
> > > drive). But i want to save it to:
http://servername/myhomepage/randomdir.
> > > Replacing the desktop directory with the http directory does not work.
> > > Does anyone have a solution
> > >
> > >
> > >
> > > Sub ExportChart2JPG()
> > >
> > > Sheets("Graphs").Select
> > > ActiveSheet.ChartObjects("Grafiek 2").Activate
> > > ActiveChart.ChartArea.Select
> > > ActiveChart.Export Filename:="C:\Documents and Settings\Erik\Desktop
> > > \Grafiek2.jpg", _
> > > FilterName:="jpeg"
> > >
> > > End Sub
> > >
>