473,394 Members | 1,902 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,394 software developers and data experts.

How to insert images into a Microsoft Word document using VB.NET??

JSL
How to insert images into a Microsoft Word document using VB.NET??

my code:
Public Function PictureReport()

(it doesn't work!!!)
On Error Resume Next
Dim oDoc As Word.Document
Dim range As Word.Range

oDoc = GetObject(strIniFileName)
oDoc.Bookmarks.Item("Pic").Range.InlineShapes.AddP icture(fileName:="C:\temp\Pic\test2.jpg",
LinkToFile:=False, SaveWithDocument:=True) '<- this park doesn't work
'Save Document
oDoc.SaveAs(Filename:=strIniSave & "\" & "outCome2" & ".doc")

'close the word Document, App still open
oDoc.Close()
oDoc = Nothing
Exit Function
ErrorHandle:
MessageBox.Show("Template file missing.")
End Function

thankyou

Aug 28 '06 #1
1 5653
Try the microsoft.public.vsnet.vstools.office newsgroup.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

It takes a tough man to make a tender chicken salad.
"JSL" <ji*************@yahoo.com.hkwrote in message
news:11*********************@b28g2000cwb.googlegro ups.com...
How to insert images into a Microsoft Word document using VB.NET??

my code:
Public Function PictureReport()

(it doesn't work!!!)
On Error Resume Next
Dim oDoc As Word.Document
Dim range As Word.Range

oDoc = GetObject(strIniFileName)
oDoc.Bookmarks.Item("Pic").Range.InlineShapes.AddP icture(fileName:="C:\temp\Pic\test2.jpg",
LinkToFile:=False, SaveWithDocument:=True) '<- this park doesn't work
'Save Document
oDoc.SaveAs(Filename:=strIniSave & "\" & "outCome2" & ".doc")

'close the word Document, App still open
oDoc.Close()
oDoc = Nothing
Exit Function
ErrorHandle:
MessageBox.Show("Template file missing.")
End Function

thankyou

Aug 29 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: aparna | last post by:
Hi To All I am doing one task, in that i am having Word document, and want to insert that word document in the database using asp.net.Pleas tell me which data type can i take in database to...
0
by: Ken Ingram | last post by:
I have been reading through all the MSDN docs on using the new Visual Studio Tools for Microsoft Office Systems and have alot of things working in my project. One thing I am stuggling with is how...
3
by: Adam Faulkner via DotNetMonster.com | last post by:
I want to create a method within a class that opens a Microsoft Word 2000 Document and has the facility to Create a new word document and then extract a Page that exists within the original Word...
2
by: Yaseen D M | last post by:
I have aspx page which contains some gif, jpg and png images. PNG image is generated dynamically. This file is basically a graph image. The problem i am facing in exporting these images to word,...
11
by: sandeepkedlaya | last post by:
Hello, I need to copy images from a folder and copy to a word document. I have done as follows.. but It copies only last image. Can any one of you help me in this.. Private Sub Page_Load(ByVal...
0
by: madval | last post by:
hi, i'm inserting some images in a word document, and i want to separate this images with a carriage return, but when i insert new lines they are inserted at the end of document. i want to insert:...
0
by: avisekrishi | last post by:
Hi , I have 100 image . I need to follow the following steps 1. Open a word document 2. Click on Insert -> Picture -> File and then open the image file 3. The Image gets opened in Word.
3
by: tesa | last post by:
Thanks for the help early this morning! The one problem I can not figure out still is how to swap the images. I have the images in an array. is the image to start with.... then as the player...
1
by: Pedro Rosas Silva | last post by:
Hi everyone, Is anybody aware of a way how to insert an image in a WordML document programmatically, through C#? I have a C# application that loads into memory a WordML document...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.