473,386 Members | 1,754 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Saving Image From Clipboard

Trying load an embedded object to the clipboard and then save it to a file. When I try and save to the file, I'm getting a "Object reference not set to an instance of an object". I've marked the line with ---->>> where the error occurs. Any help would be appreciated. Code is below. Using VB.NET

Dim InShapeObj As Word.InlineShape
Dim SaveObj As New DataObject
Dim ImageObj As Image
Dim WordApp As New Word.ApplicationClass
WordApp.Visible = True
Dim aDoc As Word.Document = WordApp.Documents.Open(Me.FileExtract1.Text)
Dim data As IDataObject = Clipboard.GetDataObject()
Dim fmt As String
Dim FileName As String
Dim MemStrm As MemoryStream
aDoc.Activate()
For Each InShapeObj In aDoc.InlineShapes
If InShapeObj.OLEFormat.IconLabel <> "" Then
FileName = "c:\" + InShapeObj.OLEFormat.IconLabel
InShapeObj.Select()
WordApp.Selection.Copy()
SaveObj = Clipboard.GetDataObject()
If (SaveObj.GetDataPresent(DataFormats.EnhancedMetafi le)) Then
ImageObj = Clipboard.GetDataObject.GetData(DataFormats.Enhanc edMetafile)
--->>>>> ImageObj.Save(FileName, System.Drawing.Imaging.ImageFormat.Emf)
End If
End If
Next InShapeObj
Oct 12 '06 #1
0 1237

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Vlado | last post by:
Hello, I need to copy/paste image from Java application to/from the System clipboard. On windows everything is just fine, but on Mac OS is not. The problem is that when I transfer image to the...
1
by: VB User | last post by:
Earlier in VB6, the image was copied onto the clipboard from the Image Processing Program . This image would then be loaded onto the image control on the VB form using GetData() function. In...
15
by: Anand Ganesh | last post by:
HI All, I have an Image. I want to clip a portion of it and copy to another image. How to do this? I know the bounding rectangle to clip. Any suggestions please. Thanks for your time and...
0
by: P N | last post by:
Hi all, I have question about copying picture from MS-Word into the Clipboard and then copy from the Clipboard into the bitmap variable within C#. The original image size is 2288 x 1712. If I...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
2
by: steve | last post by:
Hi All I have a program which takes photos of members using a web cam, then saves them as bitmap files The bitmap is used by a Picturebox to display the photo and clicking on a button enables...
0
by: mhospodarsky | last post by:
Hi-- I am using VB.Net 2002 for this app. I am working with Tiff and jpeg images. I have a picturebox set up that I use to view the images. I have the picture box inside of a scrollable...
3
by: NoDozing | last post by:
Trying load an embedded object to the clipboard and then save it to a file. When I try and save to the file, I'm getting a "Object reference not set to an instance of an object". I've marked the line...
5
by: exhuma.twn | last post by:
As many might know, windows allows to copy an image into the clipboard by pressing the "Print Screen" button on the keyboard. Is it possible to paste such an image from the clipboard into a "Text"...
1
by: nikhilkajrekar | last post by:
i have picturedata and i want to save that to image file how i can do that i have this function but not working for all images Function FPictureDataToClipBoard(ctl As Variant) As Boolean '...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.