470,614 Members | 1,549 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,614 developers. It's quick & easy.

Inserting a PictureBox picture into Word document

How do I go about doing this? Basically I have a field where the user
inputs a doctors name, a field where the user inputs the doctors bio, and
then a picturebox where they select an image from their hard disk. I need
all this info to be saved into a Word template, but I'm not sure how to do
it.

I program in C++, but I have had some experience with VB.
Nov 20 '05 #1
2 5236
Cor
Hi Rick,

I understand that you want to use for that Word and VBA (visual basic for
applications)

VBA looks more on VB.net than C++, but with that is all said, you better
take a look also in a Word developper newsgroup (office developper
newsgroup)

I hope this brings you on the route for your solution.

Cor
How do I go about doing this? Basically I have a field where the user
inputs a doctors name, a field where the user inputs the doctors bio, and
then a picturebox where they select an image from their hard disk. I need
all this info to be saved into a Word template, but I'm not sure how to do
it. I program in C++, but I have had some experience with VB.

Nov 20 '05 #2
Hi Rick,

Here I write some code for you.
Imports Microsoft.Office.Interop
Module Module1
Sub Main()
Dim wdApp As New Word.Application
wdApp.Visible = True
wdApp.Documents.Add()
wdApp.ActiveDocument.Range.InlineShapes.AddPicture ("c:\dafen.jpg")
wdApp.ActiveDocument.SaveAs("c:\test.dot",
Word.WdSaveFormat.wdFormatTemplate)
End Sub
End Module

Did this does the job for you, if you have any concern on this issue please
post here.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
From: "Rick" <un*****@unknown.com>
Newsgroups: microsoft.public.dotnet.languages.vb
Subject: Inserting a PictureBox picture into Word document
Lines: 9
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <Vgztb.3196$Ue4.302@fed1read01>
Date: Sat, 15 Nov 2003 16:11:45 -0800
NNTP-Posting-Host: 68.104.98.141
X-Complaints-To: ab***@cox.net
X-Trace: fed1read01 1068941493 68.104.98.141 (Sat, 15 Nov 2003 19:11:33 EST)NNTP-Posting-Date: Sat, 15 Nov 2003 19:11:33 EST
Organization: Cox Communications
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!news-out.cwix.com!newsfeed.cwix.co
m!nntp1.roc.gblx.net!nntp.gblx.net!nntp.gblx.net!p riapus.visi.com!news-out.v
isi.com!green.readfreenews.net!news.readfreenews.n et!cox.net!news-xfer.cox.n
et!p01!fed1read01.POSTED!not-for-mailXref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:157125
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

How do I go about doing this? Basically I have a field where the user
inputs a doctors name, a field where the user inputs the doctors bio, and
then a picturebox where they select an image from their hard disk. I need
all this info to be saved into a Word template, but I'm not sure how to do
it.

I program in C++, but I have had some experience with VB.


Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Adam Faulkner via DotNetMonster.com | last post: by
reply views Thread by =?Utf-8?B?dXNlcjEyMzQ=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.