Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Chart2JPG and export to webpage directory

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Chart2JPG and export to webpage directory

Try exporting it as a .gif and don't include the 'FilterName' argument at
all, or FilterName as an empty string, "".

Regards,
Peter T

wrote in message
oups.com...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Chart2JPG and export to webpage directory

I tried it with the following code but still no succes. Any more
suggestions or is my code faulty?


<uQuote of error message:</u
Error 1004 during execution
Export of object_chart failes

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

wrote in message
oups.com...
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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Chart2JPG and export to webpage directory

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

wrote in message
ups.com...
I tried it with the following code but still no succes. Any more
suggestions or is my code faulty?


<uQuote of error message:</u
Error 1004 during execution
Export of object_chart failes

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

wrote in message
oups.com...
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change current directory to the directory that the workbook loads from! alondon Excel Programming 5 April 17th 07 06:05 AM
Enter data into excel and export it to a webpage Gabriel s0litud3 Excel Programming 0 February 22nd 06 02:01 PM
Creating a macro that lists directory names within a directory.... Andy Excel Programming 4 November 28th 04 06:13 AM
Check if directory empty OR no of files in directory. Michael Beckinsale Excel Programming 2 December 4th 03 10:12 PM


All times are GMT +1. The time now is 11:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"