473,467 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

insert picture in word through vb

137 New Member
hi everyone
i have a problem, i just export the data from data grid to the word file, but now the problem is i want to insert the picture in the word with the path name in the grid.

for ex;
i have three fields in the data grid
1 name
2. address
3 pic path

i just exported the name, address and the path name of the picture but can't insert the actual picture.
plz experts, help
with best regards
Apr 27 '07 #1
5 12098
SammyB
807 Recognized Expert Contributor
Something like this:
Expand|Select|Wrap|Line Numbers
  1. ActiveDocument.Shapes.AddPicture _
  2.         FileName:="C:\My Pictures\Demo.JPG", _
  3.         Left:=100, Top:=200, SaveWithDocument:=True
Apr 27 '07 #2
coolminded
137 New Member
thanx SammyB for the answer
it did work but i want it to be opened in the tabular form. i,e. all other informations are displayed in the table, so i want the picture of the corresponding name should be displayed in the same row.

name---------------------------add --------------------------------------------pic
abc --------------------------xyz---------------------------------------------pic of abc
abc1 --------------------------xyz1---------------------------------------------pic of abc1

i used the following code :

oDoc.Tables(1).Columns(1).Cells(1).Range.Text = fg.TextMatrix(1, 1)
oDoc.Tables(1).Columns(2).Cells(1).Range.Text = fg.TextMatrix(1, 2)
oDoc.Tables(1).Columns(3).Cells(1).Range.Text = fg.TextMatrix(1, 3) "Error for the photo"

but the image is not displayed in the table
but only outside the table.
thanx
Apr 30 '07 #3
SammyB
807 Recognized Expert Contributor
You just need to use InlineShapes:
Expand|Select|Wrap|Line Numbers
  1.  oDoc.Tables(1) .Columns(3).Cells(2).Range.InlineShapes.AddPicture FileName:=....
Apr 30 '07 #4
coolminded
137 New Member
thanx SammyB for that helpful suggestion
one more question
what if i show the data in the page not in the table. that means the name, then the pic of that name in the next line , and at the bottom the address of that name. all in the separate line.
is it possible to show it and the information of another name in the next page and so on.
thanx
May 1 '07 #5
SammyB
807 Recognized Expert Contributor
thanx SammyB for that helpful suggestion
one more question
what if i show the data in the page not in the table. that means the name, then the pic of that name in the next line , and at the bottom the address of that name. all in the separate line.
is it possible to show it and the information of another name in the next page and so on.
thanx
Actually, I don't know how to do any of this. :D I just record a macro and look at the code, and post it for you. None of the Office products have that difficult an object model. Try recording a macro and see what you can do. Note, Word is a little tough because you cannot navigate thru the document with the mouse while in the Macro Recorder. So, before you start, look at Help, Keyboard Shrotcuts, Move the Insertion Point. HTH --Sam
May 1 '07 #6

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

Similar topics

0
by: kstriyhon | last post by:
hellow i have a jpg picture in Base64 encoded format and i need to insert this picture in a word document. is this possible?? if it's how can i do this?? i'm using the word object library. any...
1
by: KELVIN TRAN | last post by:
There are anyway to insert a picture or MS Word file in this text box (Make easy for question or discussion)? Thank you very much for your help. Best regards, Kelvin Tran *** Sent via...
1
by: blue_nirvana | last post by:
I have a form that a user loads pictures onto using picture boxes. I want to be able to insert those pictures into a Word document. How can I insert a picture into a Word document through...
1
by: blue_nirvana | last post by:
I am having trouble sizing a picture after inserting it into Word using VB.NET. I have a Windows form that allows a user to select several pictures from file. They can then export those pictures...
2
by: zheng | last post by:
ÇçÌì I have a word document and it has a picture object, I want save the picture object as other single picture file by C# program. I have a idea, by clipboard, copy the picture to clipboard, and...
1
by: Fabian | last post by:
Hi all, I need an example to insert an Picture in an opend Word Document. My Code doesn t work. I tried : object vk_missing = Type.Missing;...
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: abspring | last post by:
Hi I am a technology teacher/support person at an elementary school. I have created a database in which I need to insert a picture for each of our 650+ students. I have a table of student...
0
by: thatguyNYC | last post by:
I'm wondering if it's possible to insert an image into a placeholder in a Word template (from Access). I have several fields (using custom document properties) such as name, employee title,...
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
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,...
1
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...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.