Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cant "picture" Format from Clipboard to .bmp file type
This actually being done in VB.Net. But I am using hte Excel 12.0 object
model. I could not get an answer in the VSTO/VB forums and thought maybe I could get it here. Note as this is in VB I am using Excel enumerations but it is essentially VBA. I can do the following in VB: xlSheet.UsedRange.CopyPicture(Excel.XlPictureAppea rance.xlScreen, Excel.XlCopyPictureFormat.xlBitMap) 'Copy Image from Clipboard to temp folder Dim oImgObj As Image = Clipboard.GetImage oImgObj.Save(FileCompareFolder & "\[" & xlBook.Name & "]" & xlSheet.Name & ".bmp", System.Drawing.Imaging.ImageFormat.Bmp) However when I change the first line to (note the underlined portion) xlSheet.UsedRange.CopyPicture(Excel.XlPictureAppea rance.xlPrinter , Excel.XlCopyPictureFormat.xlPicture ) I get the following error message:"Object reference not set to an instance of an object." on the line: oImgObj.Save(FileCompareFolder & "\[" & xlBook.Name & "]" & xlSheet.Name & ".bmp", System.Drawing.Imaging.ImageFormat.Bmp) Why is this? When I do this manually by copying ot clipboard and saving in Paint I can use the bmp extension. Thanks EM |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cant "picture" Format from Clipboard to .bmp file type
Come on throw me a bone. This is killing me. Why can't I save this as a
..bmp file when using the "XLpicture" format? Thanks EM "ExcelMonkey" wrote: This actually being done in VB.Net. But I am using hte Excel 12.0 object model. I could not get an answer in the VSTO/VB forums and thought maybe I could get it here. Note as this is in VB I am using Excel enumerations but it is essentially VBA. I can do the following in VB: xlSheet.UsedRange.CopyPicture(Excel.XlPictureAppea rance.xlScreen, Excel.XlCopyPictureFormat.xlBitMap) 'Copy Image from Clipboard to temp folder Dim oImgObj As Image = Clipboard.GetImage oImgObj.Save(FileCompareFolder & "\[" & xlBook.Name & "]" & xlSheet.Name & ".bmp", System.Drawing.Imaging.ImageFormat.Bmp) However when I change the first line to (note the underlined portion) xlSheet.UsedRange.CopyPicture(Excel.XlPictureAppea rance.xlPrinter , Excel.XlCopyPictureFormat.xlPicture ) I get the following error message:"Object reference not set to an instance of an object." on the line: oImgObj.Save(FileCompareFolder & "\[" & xlBook.Name & "]" & xlSheet.Name & ".bmp", System.Drawing.Imaging.ImageFormat.Bmp) Why is this? When I do this manually by copying ot clipboard and saving in Paint I can use the bmp extension. Thanks EM |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cant "picture" Format from Clipboard to .bmp file type
Hi,
Make sure you have SP2 installed as not being able to copyas Bitmap was a bug. Cheers Andy -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info "ExcelMonkey" wrote in message ... Come on throw me a bone. This is killing me. Why can't I save this as a .bmp file when using the "XLpicture" format? Thanks EM "ExcelMonkey" wrote: This actually being done in VB.Net. But I am using hte Excel 12.0 object model. I could not get an answer in the VSTO/VB forums and thought maybe I could get it here. Note as this is in VB I am using Excel enumerations but it is essentially VBA. I can do the following in VB: xlSheet.UsedRange.CopyPicture(Excel.XlPictureAppea rance.xlScreen, Excel.XlCopyPictureFormat.xlBitMap) 'Copy Image from Clipboard to temp folder Dim oImgObj As Image = Clipboard.GetImage oImgObj.Save(FileCompareFolder & "\[" & xlBook.Name & "]" & xlSheet.Name & ".bmp", System.Drawing.Imaging.ImageFormat.Bmp) However when I change the first line to (note the underlined portion) xlSheet.UsedRange.CopyPicture(Excel.XlPictureAppea rance.xlPrinter , Excel.XlCopyPictureFormat.xlPicture ) I get the following error message:"Object reference not set to an instance of an object." on the line: oImgObj.Save(FileCompareFolder & "\[" & xlBook.Name & "]" & xlSheet.Name & ".bmp", System.Drawing.Imaging.ImageFormat.Bmp) Why is this? When I do this manually by copying ot clipboard and saving in Paint I can use the bmp extension. Thanks EM |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cant "picture" Format from Clipboard to .bmp file type
I am using XP and VS 2008. When you say SP2 do you mean for the XP
Operating System or for Visual Studio 2008? Thanks EM "Andy Pope" wrote: Hi, Make sure you have SP2 installed as not being able to copyas Bitmap was a bug. Cheers Andy -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info "ExcelMonkey" wrote in message ... Come on throw me a bone. This is killing me. Why can't I save this as a .bmp file when using the "XLpicture" format? Thanks EM "ExcelMonkey" wrote: This actually being done in VB.Net. But I am using hte Excel 12.0 object model. I could not get an answer in the VSTO/VB forums and thought maybe I could get it here. Note as this is in VB I am using Excel enumerations but it is essentially VBA. I can do the following in VB: xlSheet.UsedRange.CopyPicture(Excel.XlPictureAppea rance.xlScreen, Excel.XlCopyPictureFormat.xlBitMap) 'Copy Image from Clipboard to temp folder Dim oImgObj As Image = Clipboard.GetImage oImgObj.Save(FileCompareFolder & "\[" & xlBook.Name & "]" & xlSheet.Name & ".bmp", System.Drawing.Imaging.ImageFormat.Bmp) However when I change the first line to (note the underlined portion) xlSheet.UsedRange.CopyPicture(Excel.XlPictureAppea rance.xlPrinter , Excel.XlCopyPictureFormat.xlPicture ) I get the following error message:"Object reference not set to an instance of an object." on the line: oImgObj.Save(FileCompareFolder & "\[" & xlBook.Name & "]" & xlSheet.Name & ".bmp", System.Drawing.Imaging.ImageFormat.Bmp) Why is this? When I do this manually by copying ot clipboard and saving in Paint I can use the bmp extension. Thanks EM |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cant "picture" Format from Clipboard to .bmp file type
Neither of those.
SP2 for Office 2007, which includes Excel 12.0 Cheers Andy ExcelMonkey wrote: I am using XP and VS 2008. When you say SP2 do you mean for the XP Operating System or for Visual Studio 2008? Thanks EM "Andy Pope" wrote: Hi, Make sure you have SP2 installed as not being able to copyas Bitmap was a bug. Cheers Andy -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info "ExcelMonkey" wrote in message ... Come on throw me a bone. This is killing me. Why can't I save this as a .bmp file when using the "XLpicture" format? Thanks EM "ExcelMonkey" wrote: This actually being done in VB.Net. But I am using hte Excel 12.0 object model. I could not get an answer in the VSTO/VB forums and thought maybe I could get it here. Note as this is in VB I am using Excel enumerations but it is essentially VBA. I can do the following in VB: xlSheet.UsedRange.CopyPicture(Excel.XlPictureA ppearance.xlScreen, Excel.XlCopyPictureFormat.xlBitMap) 'Copy Image from Clipboard to temp folder Dim oImgObj As Image = Clipboard.GetImage oImgObj.Save(FileCompareFolder & "\[" & xlBook.Name & "]" & xlSheet.Name & ".bmp", System.Drawing.Imaging.ImageFormat.Bmp) However when I change the first line to (note the underlined portion) xlSheet.UsedRange.CopyPicture(Excel.XlPictureA ppearance.xlPrinter , Excel.XlCopyPictureFormat.xlPicture ) I get the following error message:"Object reference not set to an instance of an object." on the line: oImgObj.Save(FileCompareFolder & "\[" & xlBook.Name & "]" & xlSheet.Name & ".bmp", System.Drawing.Imaging.ImageFormat.Bmp) Why is this? When I do this manually by copying ot clipboard and saving in Paint I can use the bmp extension. Thanks EM -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cant "picture" Format from Clipboard to .bmp file type
Let me get back to you on this.
Thanks EM "Andy Pope" wrote: Neither of those. SP2 for Office 2007, which includes Excel 12.0 Cheers Andy ExcelMonkey wrote: I am using XP and VS 2008. When you say SP2 do you mean for the XP Operating System or for Visual Studio 2008? Thanks EM "Andy Pope" wrote: Hi, Make sure you have SP2 installed as not being able to copyas Bitmap was a bug. Cheers Andy -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info "ExcelMonkey" wrote in message ... Come on throw me a bone. This is killing me. Why can't I save this as a .bmp file when using the "XLpicture" format? Thanks EM "ExcelMonkey" wrote: This actually being done in VB.Net. But I am using hte Excel 12.0 object model. I could not get an answer in the VSTO/VB forums and thought maybe I could get it here. Note as this is in VB I am using Excel enumerations but it is essentially VBA. I can do the following in VB: xlSheet.UsedRange.CopyPicture(Excel.XlPictureA ppearance.xlScreen, Excel.XlCopyPictureFormat.xlBitMap) 'Copy Image from Clipboard to temp folder Dim oImgObj As Image = Clipboard.GetImage oImgObj.Save(FileCompareFolder & "\[" & xlBook.Name & "]" & xlSheet.Name & ".bmp", System.Drawing.Imaging.ImageFormat.Bmp) However when I change the first line to (note the underlined portion) xlSheet.UsedRange.CopyPicture(Excel.XlPictureA ppearance.xlPrinter , Excel.XlCopyPictureFormat.xlPicture ) I get the following error message:"Object reference not set to an instance of an object." on the line: oImgObj.Save(FileCompareFolder & "\[" & xlBook.Name & "]" & xlSheet.Name & ".bmp", System.Drawing.Imaging.ImageFormat.Bmp) Why is this? When I do this manually by copying ot clipboard and saving in Paint I can use the bmp extension. Thanks EM -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cant "picture" Format from Clipboard to .bmp file type
No this didn't fix it. I didn't have SP2 installed in Office 2007. But
installing it still produces the same error: "Object reference not set to an instance of an object." on the line of code: oImgObj.Save(FileCompareFolder & "\[" & xlBook.Name & "]" & xlSheet.Name & ".bmp", System.Drawing.Imaging.ImageFormat.Bmp) And again this fails when I use the xlPrinter and xlPicture properties but it works when I use the xlScreen and xlbitmap properties. Thanks EM "ExcelMonkey" wrote: Let me get back to you on this. Thanks EM "Andy Pope" wrote: Neither of those. SP2 for Office 2007, which includes Excel 12.0 Cheers Andy ExcelMonkey wrote: I am using XP and VS 2008. When you say SP2 do you mean for the XP Operating System or for Visual Studio 2008? Thanks EM "Andy Pope" wrote: Hi, Make sure you have SP2 installed as not being able to copyas Bitmap was a bug. Cheers Andy -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info "ExcelMonkey" wrote in message ... Come on throw me a bone. This is killing me. Why can't I save this as a .bmp file when using the "XLpicture" format? Thanks EM "ExcelMonkey" wrote: This actually being done in VB.Net. But I am using hte Excel 12.0 object model. I could not get an answer in the VSTO/VB forums and thought maybe I could get it here. Note as this is in VB I am using Excel enumerations but it is essentially VBA. I can do the following in VB: xlSheet.UsedRange.CopyPicture(Excel.XlPictureA ppearance.xlScreen, Excel.XlCopyPictureFormat.xlBitMap) 'Copy Image from Clipboard to temp folder Dim oImgObj As Image = Clipboard.GetImage oImgObj.Save(FileCompareFolder & "\[" & xlBook.Name & "]" & xlSheet.Name & ".bmp", System.Drawing.Imaging.ImageFormat.Bmp) However when I change the first line to (note the underlined portion) xlSheet.UsedRange.CopyPicture(Excel.XlPictureA ppearance.xlPrinter , Excel.XlCopyPictureFormat.xlPicture ) I get the following error message:"Object reference not set to an instance of an object." on the line: oImgObj.Save(FileCompareFolder & "\[" & xlBook.Name & "]" & xlSheet.Name & ".bmp", System.Drawing.Imaging.ImageFormat.Bmp) Why is this? When I do this manually by copying ot clipboard and saving in Paint I can use the bmp extension. Thanks EM -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
CopyPicture Method and "Picture/BitMap" Format | Excel Programming | |||
hyperlink no picture "No program is regitered to open this file" | Setting up and Configuration of Excel | |||
Default display format for "currency" data type | Excel Discussion (Misc queries) | |||
Where is the toolbar with the "bold type", "font type", options | New Users to Excel |