I am having trouble getting this code to work. I have an open
workbook, with an active worksheet named "Sheet1" which has an embeded
chart (object) here is my code that runs when you press the
CommandButton1 on the user form I created:
Private Sub CommandButton1_Click()
Call Create_GIF
Image1.Picture = LoadPicture("c:\Mychart.gif")
End Sub
Sub Create_GIF()
With Worksheets("Sheet1").ChartObjects(1).Chart
.HasTitle = True
.ChartTitle.Text = "1995 Rainfall Totals by Month"
.Export Filename:="layth.gif", FilterName:="GIF"
End With
The code works until the .export line, the Chart get a new name as I
specefied in the line .ChartTitle.......
but I recieve the following error message:
RUN TIME ERROR '1004':
Application-defined or Object-defined error
Where am I going wrong here. I tried changing the filename to "layth"
, I also tried using jpg instead, but nothing worked.
Can someone help PLEASE.
workbook, with an active worksheet named "Sheet1" which has an embeded
chart (object) here is my code that runs when you press the
CommandButton1 on the user form I created:
Private Sub CommandButton1_Click()
Call Create_GIF
Image1.Picture = LoadPicture("c:\Mychart.gif")
End Sub
Sub Create_GIF()
With Worksheets("Sheet1").ChartObjects(1).Chart
.HasTitle = True
.ChartTitle.Text = "1995 Rainfall Totals by Month"
.Export Filename:="layth.gif", FilterName:="GIF"
End With
The code works until the .export line, the Chart get a new name as I
specefied in the line .ChartTitle.......
but I recieve the following error message:
RUN TIME ERROR '1004':
Application-defined or Object-defined error
Where am I going wrong here. I tried changing the filename to "layth"
, I also tried using jpg instead, but nothing worked.
Can someone help PLEASE.