ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to export chart to a network drive? (https://www.excelbanter.com/excel-programming/406671-how-export-chart-network-drive.html)

[email protected]

How to export chart to a network drive?
 
I tried to export a chart to a network drive but it appeared an error
said "object variable or withblock variable not set".
here is the code:
Private Sub Workbook_Deactivate()
Application.ActiveWorkbook.ActiveChart.Export Filename:="\\dc\youu
\MyChart.gif", _
FilterName:="GIF"
End Sub

I try to add the codes below at the beginning,but it appeared the same
error.
ChDir "\\dc\Operation\Store-Department"

can anyone tell me the reason? How to solve this problem?
Thank you

Tim Williams

How to export chart to a network drive?
 
Maybe no chart is active ?

Tim


wrote in message
...
I tried to export a chart to a network drive but it appeared an error
said "object variable or withblock variable not set".
here is the code:
Private Sub Workbook_Deactivate()
Application.ActiveWorkbook.ActiveChart.Export Filename:="\\dc\youu
\MyChart.gif", _
FilterName:="GIF"
End Sub

I try to add the codes below at the beginning,but it appeared the same
error.
ChDir "\\dc\Operation\Store-Department"

can anyone tell me the reason? How to solve this problem?
Thank you




[email protected]

How to export chart to a network drive?
 
On Feb 26, 12:00*pm, "Tim Williams" <timjwilliams at gmail dot com
wrote:
Maybe no chart is active ?

Tim

wrote in message

...



I tried to export a chart to a network drive but it appeared an error
said "object variable or withblock variable not set".
here is the code:
Private Sub Workbook_Deactivate()
Application.ActiveWorkbook.ActiveChart.Export Filename:="\\dc\youu
\MyChart.gif", _
FilterName:="GIF"
End Sub


I try to add the codes below at the beginning,but it appeared the same
error.
ChDir "\\dc\Operation\Store-Department"


can anyone tell me the reason? How to solve this problem?
Thank you- Hide quoted text -


- Show quoted text -


haha, how stupid i am. you're right, no chart is active. so how can i
select/activate a certain chart to export if there are many charts in
a sheet?

Tim Williams

How to export chart to a network drive?
 
Find the name of the chartobject and use something like

with Activeworkbook.sheets("sheetname").Chartobjects("c hartname")
.Chart.Export Filename:="\\dc\youu\MyChart.gif", FilterName:="GIF"
end with

That's for a chart embedded on a worksheet - it's not clear from your post
whether you have that or a chartsheet....

Tim

wrote in message
...
On Feb 26, 12:00 pm, "Tim Williams" <timjwilliams at gmail dot com
wrote:
Maybe no chart is active ?

Tim

wrote in message

...



I tried to export a chart to a network drive but it appeared an error
said "object variable or withblock variable not set".
here is the code:
Private Sub Workbook_Deactivate()
Application.ActiveWorkbook.ActiveChart.Export Filename:="\\dc\youu
\MyChart.gif", _
FilterName:="GIF"
End Sub


I try to add the codes below at the beginning,but it appeared the same
error.
ChDir "\\dc\Operation\Store-Department"


can anyone tell me the reason? How to solve this problem?
Thank you- Hide quoted text -


- Show quoted text -


haha, how stupid i am. you're right, no chart is active. so how can i
select/activate a certain chart to export if there are many charts in
a sheet?




All times are GMT +1. The time now is 10:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com