Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save sheet bitmap to desktop?
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save sheet bitmap to desktop?
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save sheet bitmap to desktop?
On Aug 17, 9:31*am, 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 Hi! Admittedly, I'm not very good at doing the substitutions sometimes and this one stumped me. I did the best I could and invoked the macro but got an error 13 type mismatch code. Admittedly, the substitutions I made don't look good: Sub Create_GIF() Dim fn As String Dim mychart As Chart fn = "\\CompanyName\Users\Reception\Desktop\Tod+Tom ." & Range("B1:B4").Value & ".gif" 'MsgBox fn Set mychart = ActiveSheet.ChartObjects(1).Chart mychart.Export Filename:=fn, FilterName:="GIF" End Sub (file name output hopefully would be Tod+Tom.gif) How can I fix please? Thanks!! :oD |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save sheet bitmap to desktop?
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! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save sheet bitmap to desktop?
[snip]
1) *It saves a GIF of the range B1:B4, yes, but drags the chart background with it. *Can the range itself be the only thing *exported, by any chance? *Would the parameters in oRange.CopyPicture xlScreen, xlPicture be the culprits (xlScreen???). 2) *Error capture re path possible? *If desktop is not P:\0DESKTOP\, as when I do this at work where desktop at different location, any way to prompt user to change path? Hi, everyone. I have tried to fix this myself but I have had no luck. On the code above, is there _any_ way to JUST get the range exported? The export includes what must be a temporary chart background. Secondly, any error correction possible on the path? Thank you! :oD |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Save as bitmap | Excel Programming | |||
save as - to any desktop | Excel Programming | |||
how to save an image as a bitmap | Excel Programming | |||
Save Userform as bitmap | Excel Programming | |||
Save .xls as .txt In DeskTop | Excel Programming |