K
Kenny Bones
Hi, I've finally figured out how to use a macro to insert an image as an
oShape and not inline shape.
However, I don't quite know how to figure the last bit out.
Preferrably, I would like to have a simple shape in the document.
And have a macro fire when the shape is clicked with the mouse.
Not sure if this is even possible.
But the thing is, I'm actually trying to create a picture placeholder for
Word 2003.
And I want the picture to replace the placeholder. I could use a button
though, but that would mean that the button would appear on the print of the
document.
I can't have that, so I would like to have a shape or something instead
which would not appear on the print, either by coloring it white or
something.
My current macro looks like this:
Suggestions?
oShape and not inline shape.
However, I don't quite know how to figure the last bit out.
Preferrably, I would like to have a simple shape in the document.
And have a macro fire when the shape is clicked with the mouse.
Not sure if this is even possible.
But the thing is, I'm actually trying to create a picture placeholder for
Word 2003.
And I want the picture to replace the placeholder. I could use a button
though, but that would mean that the button would appear on the print of the
document.
I can't have that, so I would like to have a shape or something instead
which would not appear on the print, either by coloring it white or
something.
My current macro looks like this:
Code:
Dim oShape As Word.Shape
Dim Dlg As Office.FileDialog
Set Dlg = Application.FileDialog(msoFileDialogFilePicker)
Dim strFilePath As String
Dim oDoc As Document
Set oDoc = ActiveDocument
With Dlg
.AllowMultiSelect = False
If .Show() <> 0 Then
strFilePath = .SelectedItems(1)
End If
End With
If strFilePath = "" Then
GoTo Endofcode
End If
Set oShape = oDoc.Shapes.AddPicture(FileName:=strFilePath,
LinkToFile:=False, SaveWithDocument:=True)
With oShape
ImageWidth = .Width
ImageHeight = .Height
NewHeight = 30
NewWidth = 40
.Height = NewHeight
.Width = NewWidth
End With
Endofcode:
End Sub
Suggestions?