473,761 Members | 10,365 Online
Bytes | Software Development & Data Engineering Community
+ 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 12153
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).Cell s(1).Range.Text = fg.TextMatrix(1 , 1)
oDoc.Tables(1). Columns(2).Cell s(1).Range.Text = fg.TextMatrix(1 , 2)
oDoc.Tables(1). Columns(3).Cell s(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
1238
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 help or code sample would be appreciate. thanks in advance.
1
1880
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 Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
1
10319
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 automation using VB.NET? So far I am using the below: Dim oWord As Word.Application Dim oDoc As Word.Document 'Start Word oWord = CreateObject("Word.Application")
1
5725
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 to a Word document. I can control the size of the picture on my form using a picture box, but how can I size it in Word, using VB.NET, after I have inserted it? I want to force the picture to a certain size. I tried using a template, but the...
2
2474
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 then save as a file from clipboard, it is work well in application,but don't work in a web application. how can I to do? and are there other ideas to save the picture object in web application? help me !!
1
2825
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; wordapp.Selection.Range.InlineShapes.AddPicture(@"C:\logo.bmp", ref vk_missing, ref vk_missing, ref vk_missing);
0
1617
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
4658
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 information with the student id as the primary key. Another table is the student photos table that has the student id and the imagename.bmp of the photo of that student and a OLE Object field for the picture image. All of the actual picture files are .bmp...
0
1558
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, dept, etc, that I insert with no problems, but I also need to add in a link to an employee picture (linked to a jpg on the network) -- and the picture needs to be in a specific place in the doc. I've tried using a bookmark, which just generates an...
0
9531
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9345
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10115
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9957
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9775
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7332
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.