Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-05-2021, 07:35 AM
Evening_Muffin Evening_Muffin is offline position picture on page Windows 10 position picture on page Office 2019
Novice
position picture on page
 
Join Date: Jun 2021
Location: Latvia
Posts: 5
Evening_Muffin is on a distinguished road
Default position picture on page

Why does only the second picture anchor is placed at the last paragraph on the page?
first picture is anchored at the top of the document (first paragraph)



Code:
Set doc = ActiveDocument
    Set Parag = doc.Paragraphs.Last
         

        Set shpShape = doc.Shapes.AddPicture( _
            FileName:=strFilename1, _
            Anchor:=Parag.Range)
   
        With shpShape
            .LockAspectRatio = msoTrue
            .WrapFormat.Type = wdWrapFront
            .Top = 20
            .Left = 350

        End With

        Set shpShape2 = doc.Shapes.AddPicture( _
            FileName:=strFileName2, _
            Anchor:=Parag.Range)
   

        With shpShape2
            .LockAspectRatio = msoTrue
            .WrapFormat.Type = wdWrapFront
            .Top = 30
            .Left = 250
        End With
Reply With Quote
  #2  
Old 06-06-2021, 02:36 AM
Evening_Muffin Evening_Muffin is offline position picture on page Windows 10 position picture on page Office 2019
Novice
position picture on page
 
Join Date: Jun 2021
Location: Latvia
Posts: 5
Evening_Muffin is on a distinguished road
Default

The solution I found is from the old thread on this forum.
https://www.msofficeforums.com/word-...0-vba-tip.html
One has to insert an InLineShape then convert it to shape. Then it works consistently.
Otherwise I got some weird results (e.g., shapes were positioned differently when debuging with F8 and when the code was run with F5)
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing position of page numbers sajeel Word 4 06-05-2015 09:45 AM
Different page number position Yankel Word 2 08-01-2014 04:48 AM
position picture on page Placing the same object/picture on all pages but on alternative (mirror position) - alceste Drawing and Graphics 1 09-29-2013 06:28 PM
lock picture position and scaling sizis Drawing and Graphics 0 08-27-2013 04:22 AM
position picture on page WORD Macro - import picture - resize - position - page break - loop Nano07 Word VBA 2 11-02-2011 05:14 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:34 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft