Inserting a PictureBox picture into Word document

R

Rick

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.
 
C

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
 
P

Peter Huang

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.
--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top