|
-
Apr 19th, 2006, 07:38 AM
#1
Thread Starter
Member
[resolved]office2002 vs office2003
Hi
I have a strange problem that I can't resolve it, so that's why after googling around I landed at this page that I think is efficient enough for such kind of problems:
I have the following macro which is acting differently in office 2002 and office 2003. Here is the macro:
Sub insertAnImage()
Dim pic As Shape
Set pic = ActiveDocument.Shapes.AddPicture(Anchor:=Selection.Range, FileName:= _
"I:\vb\aPic.jpg")
With pic.WrapFormat
.AllowOverlap = True
.Type = 3 'wdWrapnone
End With
End Sub
in Word 2002:
when i position the cursor in the beginnig of a line and run this macro, the image will be inserted behind the text, that is what I intended to do!
in Word 2003:
doing the same thing here the image will be inserted on the text, so the text stays behind the image!!!
I really don't know from where it comes, is it a bug of office 2003, or is there any configuration to be made??? I hope you guys can help.
Last edited by Hack; Apr 20th, 2006 at 08:16 AM.
Reason: Added green "resolved" checkmark
-
Apr 19th, 2006, 10:41 AM
#2
Lively Member
Re: office2002 vs office2003
I think this is due to the default settings in Word 2003. You can either go to tools - options - edit and set "Insert/paste pictures as" behind text or change your code to:
VB Code:
Sub InsertAnImage()
Dim pic As Shape
Set pic = ActiveDocument.Shapes.AddPicture(Anchor:=Selection.Range, FileName:= _
"I:\vb\aPic.jpg", LinkToFile:=False, SaveWithDocument:=True)
With pic
With .WrapFormat
.AllowOverlap = True
.Type = 3
End With
.ZOrder 5
End With
End Sub
I'm using Word 2003 and this seems to work fine, although you'll have to test it in Word 2002.
Hope this helps.
Last edited by New2vba; Apr 19th, 2006 at 04:30 PM.
"Those things we must learn to do, we must learn by doing" (or hope somebody else will take pity and help out )
-
Apr 20th, 2006, 06:17 AM
#3
Thread Starter
Member
Re: office2002 vs office2003
thanx alot NEW2VBA,
both ways work, you were a great HELP!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|