• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

insert picture position in word using excel VBA

jk51

Member
Hi

I need help please on how to write coding correction part of the VBA excel program for inserting picture position in word 2010. I don't know how to write the absolute position with measurement syntax.

Here is what I need:

My picture size is H=12.75cm by W=19.32cm.
In MS Word page layout setting:
Horizontal
I want it 'Absolute position' = 3.15cm to the right of Page
Vertical
I want it 'Absolute position' = 3.44cm below Page

See my code below:

Code:
 Set aShape = wrdDoc.ActiveWindow.Selection.InlineShapes.AddPicture(Filename:=GraphImage, LinkToFile:=False, SaveWithDocument:=True).ConvertToShape
              
                With aShape
                        .Height = CentimetersToPoints(12.75)
                        .Width = CentimetersToPoints(19.32)
                      
                        .Left = CentimetersToPoints(3.15)
 
                        .RelativeHorizontalPosition = _
                            wdRelativeHorizontalPositionPage
                          
                        .Top = CentimetersToPoints(3.44)
                      
                        .RelativeVerticalPosition = _
                            wdRelativeVerticalPositionPage
                      
                        .Select
                End With


Thanks you.

Best

Mr Singh
 
Hi, jk51!
I don't understand why do you need Excel VBA code for modifying a Word file. And it's very difficult without both sample files, so consider uploading them.
Regards!
 
Hi SirJB7,

I am inserting a picture per page and there are about 80 pictures (map in emf) image. The image are all of the same size. My picture size is H=12.75cm by W=19.32cm.
I am trying to build a report generator using an excel database. I would like to insert pictures into word bookmarks.

The program is working when inserting per page but not in the correct position. All I need to know to modify the part of the VBA coding on how to write the absolute position with measurement syntax.
In MS Word page layout setting:
Horizontal
I want it 'Absolute position' = 3.15cm to the right of Page
Vertical
I want it 'Absolute position' = 3.44cm below Page

It is a small procedure coding.
I will be grateful if anyone know how to translate this on absolute position with my measurement in vba excel.

Thanks.
Mr Singh
 
Back
Top