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
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
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?
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 ?
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?
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
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
Can you post the code that you have?
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
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:
[VBA]
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
[/VBA]
Why textboxes?
Do they contain other text?
What do you want to do if the images won't fit in the textboxes?Originally Posted by ajannt9
Enjoy,
Tony
---------------------------------------------------------------
Give a man a fish and he'll eat for a day.
Teach him how to fish and he'll sit in a boat and drink beer all day.
I'm (slowly) building my own site: www.WordArticles.com
I want to resaiz image to fit in the textbox
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?