![]() |
|
|
|
#1
|
|||
|
|||
|
I have a macro which inserts an image at the current position but since a short while it inserts at the top of the page! Can anyone help? myperson = "john_doe" myfile = "g:\office\files\" + myperson + ".bmp" ActiveDocument.Shapes.AddPicture(Anchor:=Selection .Range, FileName:=myfile, _ LinkToFile:=False, SaveWithDocument:=True).WrapFormat.Type = wdWrapSquare |
|
#2
|
|||
|
|||
|
Try this instead:
Code:
Sub InsertPicture()
myperson = "john_doe"
myfile = "g:\office\files\" + myperson + ".bmp"
Selection.InlineShapes.AddPicture FileName:= _
myfile, LinkToFile:=False, _
SaveWithDocument:=True
End Sub
|
|
#3
|
|||
|
|||
|
Thanks for your help, dwirony, but I get the following error (translated from the original Dutch)
error -2147467259 (80004005) Method AddPicture of object InlineShapes failed |
|
#4
|
|||
|
|||
|
Strange - It's working fine on my computer. Are you sure you have the right filepath?
|
|
#5
|
|||
|
|||
|
Yes. The filepath works with my macro, but it puts the image at the top of the page
|
|
#6
|
|||
|
|||
|
So it was working fine before but now it is not? Is it because there is a space between "Selection" and ".Range"?
Code:
Anchor:=Selection .Range |
|
#7
|
|||
|
|||
|
Sorry, it was FFS (fat finger syndrome).
The space does not exist in the real macro. |
|
#8
|
|||
|
|||
|
I'm afraid that with my limited knowledge I cannot help you...
Hopefully someone like gmaxey or macropod will come along and solve your mystery
|
|
| Tags |
| word vba |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to position an image at a specific location from the edge of the screen / paper? | SpeedD | PowerPoint | 1 | 01-28-2015 08:04 AM |
| Losing image resolution when inserting image into MS word (2011: Mac) | Mario.N | Drawing and Graphics | 0 | 11-23-2014 02:38 AM |
| Problem Inserting Image | rbonnell | PowerPoint | 1 | 07-22-2014 07:15 AM |
Word 2010 how do i set default position for image
|
sam2149 | Word | 2 | 03-29-2014 01:41 AM |
Macro for moving one cell down from current position
|
Johnny thunder | Word VBA | 3 | 04-07-2011 04:44 PM |