PDA

View Full Version : Inserting Picture from Dialog with WordTight



ABrown
02-27-2008, 06:44 AM
I have read the post from MOSMaster and have managed to get my picture inserted in the right place and the right size, but I need the layout to be "Tight" and everything I have tried has failed. I can't seem to select the picture as everytime Word inserts one it gets a different number. I tried a text box but it says that I can't insert a picture!?

Can anyone help with what is probably a very simple solution!

Many thanks.

Annette

TonyJollans
02-27-2008, 10:06 AM
Joost (MOSMaster) hasn't been around for a while and I don't know what post you are referring to.

Could you post the code you have so far?

Tinbendr
02-28-2008, 08:53 AM
Could she mean this kb example (http://vbaexpress.com/kb/getarticle.php?kb_id=612)?

TonyJollans
02-28-2008, 10:12 AM
If so, change:


If .Name <> "" Then
ActiveDocument.Shapes.AddPicture FileName:=.Name, _
LinkToFile:=False, _
SaveWithDocument:=True, _
Left:=120, _
Top:=20, _
Width:=150, _
Height:=150, _
Anchor:=Selection.Range
End If



to:


If .Name <> "" Then
Set MyPic = (ActiveDocument.Shapes.AddPicture FileName:=.Name, _
LinkToFile:=False, _
SaveWithDocument:=True, _
Left:=120, _
Top:=20, _
Width:=150, _
Height:=150, _
Anchor:=Selection.Range)
End If



and you will have a reference in MyPic, with which you can do as you please - no need to care what the shape is called.

TonyJollans
02-28-2008, 10:14 AM
Oops! Sorry, parenthesis in the wrong place. Try ..


If .Name <> "" Then
Set MyPic = ActiveDocument.Shapes.AddPicture(FileName:=.Name, _
LinkToFile:=False, _
SaveWithDocument:=True, _
Left:=120, _
Top:=20, _
Width:=150, _
Height:=150, _
Anchor:=Selection.Range)
End If