Results 1 to 3 of 3

Thread: [resolved]office2002 vs office2003

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2006
    Posts
    34

    Resolved [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

  2. #2
    Lively Member New2vba's Avatar
    Join Date
    Sep 2005
    Location
    UK
    Posts
    95

    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:
    1. Sub InsertAnImage()
    2.  
    3. Dim pic As Shape
    4. Set pic = ActiveDocument.Shapes.AddPicture(Anchor:=Selection.Range, FileName:= _
    5.         "I:\vb\aPic.jpg", LinkToFile:=False, SaveWithDocument:=True)
    6.     With pic
    7.             With .WrapFormat
    8.                 .AllowOverlap = True
    9.                 .Type = 3
    10.             End With
    11.         .ZOrder 5
    12.     End With
    13.    
    14. 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 )

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2006
    Posts
    34

    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
  •  



Click Here to Expand Forum to Full Width