View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
StargateFan StargateFan is offline
external usenet poster
 
Posts: 61
Default Save sheet bitmap to desktop?

On Wed, 17 Aug 2011 19:12:46 -0400, StargateFan
wrote:

On Wed, 17 Aug 2011 06:31:48 -0700 (PDT), Don Guillett
wrote:

On Aug 17, 7:52*am, StargateFan wrote:
I have this macro which is invoked by pressing a button:

Sub Msg_CellsToBitmap()
'
* * Application.CutCopyMode = False
' * *Range(ActiveCell.Address,
ActiveCell.End(xlDown).Address).Select * * ' incorrect copy function;
need "copy to bitmap"
* * Range("B1:B4").CopyPicture Appearance:=xlScreen, Format:=xlBitmap
'================================================= ===================
* * MyMsgBox = MsgBox("The cells have been sent to the clipboard as an
image." & vbCrLf & vbCrLf & _
* * * * * * * * * * * "(Retrieve from the clipboard with, i.e., ^v
shortcut.) * * ", vbOKOnly + vbInformation, "DONE ...")
End Sub

Rather than saving the file manually, is there a way to save that
image to a bitmap on the desktop, with desktop destination as:

\\companyName\Users\Reception\Desktop\Tod+Tom.bmp

Thanks! *:oD

Modify to suit

Sub Create_GIF()
Dim fn As String
Dim mychart As Chart
fn = "c:\a\" & Range("a1").Value & ".gif"
'MsgBox fn
Set mychart = ActiveSheet.ChartObjects(1).Chart
mychart.Export Filename:=fn, FilterName:="GIF"
End Sub


I get a mismatch 13 error, again.

This time I didn't change anything other than the range (leaving the
formula as is gave me another error altogether and nothing happened):

Sub Create_GIF_Original()
Dim fn As String
Dim mychart As Chart
fn = "c:\a\" & Range("B1:B4").Value & ".gif"
'MsgBox fn
Set mychart = ActiveSheet.ChartObjects(1).Chart
mychart.Export Filename:=fn, FilterName:="GIF"
End Sub

The fn="c:\a\" ... line is highlighted in the debugger.

So I tried going back to some sort of basics. Using set mychart line
I got from the above code, googling came to this example:

http://answers.yahoo.com/question/in...1092437AAeLVto
Sub Create_GIF_of_workbook()
Dim mychart As Chart
Set mychart = ActiveSheet.ChartObjects(1).Chart
mychart.Export FileName:="P:\0DESKTOP\TOD+TOM.gif", FilterName:="GIF"
End Sub

But again error. This time 1004, Unable to get ChartObjects property
of the worksheet class.

All other attempts have failed so far. Help!


Hey, just realized something is sticking out like sore thumb, I have
an excel spreadsheet and not a chart. Why the line:

Set mychart = ActiveSheet.ChartObjects(1).Chart
??

Is that where problem lies?

I need this:

Range("B1:B4").CopyPicture Appearance:=xlScreen, Format:=xlBitmap

to be saved to desktop as

P:\0DESKTOP\TOD+TOM.gif

Is the chart reference best way? Thanks once again.