PDA

View Full Version : Insert Images



ajannt9
12-01-2006, 12:28 PM
I have a document with 5 textbox I like to insert different pictures in each box when the document open . I appreciate any help.

Thaks:banghead:

fumei
12-01-2006, 09:04 PM
So insert the pictures into the textboxes. I am not understanding the problem. Or even if there is a problem.

If there is a problem, please state what it is.

If you are trying to do something with VBA, then post the code. If there is some problem with your code, please post your code and clearly state what the problem is, and where in the code it seems to be.

Why are you trying to put the pictures in when the document is opened? Why do you not just put the pictures in?

ajannt9
12-01-2006, 09:20 PM
Thank you Garry
I want to do it by VBA code and I am not very familiar with VBA for example how can I select a TextBox on VBA to insert a picture in it ?

mdmackillop
12-02-2006, 01:52 AM
Do you mean you want a different set of pictures each time you use the file? Are these to be chosen at random, in sequence from a folder of picures or in some other way?

ajannt9
12-02-2006, 08:39 AM
Yes each time that I open the document I like to Insert images that related to another application. I have code to chose images I just want to know how I select textbox in VBA to insert the image without changing the size of textbox
Thanks

mdmackillop
12-02-2006, 12:15 PM
Can you post the code that you have?

ajannt9
12-02-2006, 09:53 PM
The Document is a mail merge document and has 4 textbox on that every time that the document open I want to put 4 different images display on these textboxes the path and the name of these images are located in file name c:\windows\Fileloc.LOC here is my code:


Private Sub Document_Open()
GetImages
End Sub

Public Sub GetImages()
On Error Resume Next
Dim PatID As String
Dim Path As String
If Dir$("c:\windows\Fileloc.LOC") <> "" Then
Close 1
Open "c:\windows\Fileloc.LOC" For Input As #1
Line Input #1, Path ' This is Image Path
Line Input #1, PatID ' This is part of file name

End If
Close 1
' Here I need your help
' I want to put image on each textbox the name file are Path+PatID+”1.jpg”
'and Path+PatId+”2.jpg” and so on
End Sub

TonyJollans
12-03-2006, 02:01 AM
Why textboxes?

Do they contain other text?


... to insert the image without changing the size of textbox

What do you want to do if the images won't fit in the textboxes?

ajannt9
12-03-2006, 02:10 AM
I want to resaiz image to fit in the textbox

fumei
12-03-2006, 03:05 AM
Easier said than done, although it can be done.

It may be better to use ActiveX Image controls, and play with the PictureSizeMode property.

So I too ask, why textboxes?