Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CopyPicture Method and "Picture/BitMap" Format ExcelMonkey Excel Programming 2 September 3rd 09 08:16 PM
hyperlink no picture "No program is regitered to open this file" Paul Setting up and Configuration of Excel 0 August 12th 08 04:49 AM
Default display format for "currency" data type Cynthia Excel Discussion (Misc queries) 1 June 29th 07 01:12 PM
Where is the toolbar with the "bold type", "font type", options fwccbcc New Users to Excel 2 May 3rd 06 09:11 PM


All times are GMT +1. The time now is 05:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"