Solved

Building a word document in vb.net - Ability to format the header jpg.

Posted on 2012-03-30
1
419 Views
Last Modified: 2012-06-21
With the code below I am able to add the jpg file to the word document header but I am unable to modify.  I need the ability to format the picture to Horizontal Alignment = Left and wrapping style = Behind Text, and adjust the size of the photo to include the entire width of the document.

oWord.ActiveWindow.ActivePane.View.SeekView = Word.WdSeekView.wdSeekCurrentPageHeader

 oWord.ActiveWindow.Selection.InlineShapes.AddPicture(FileName:="G:\apps\EXECSRCH\header.jpg", LinkToFile:=False, SaveWithDocument:=True)

Any help would be greatly appreciated.

Thank you,
Vince
0
Comment
Question by:wittkieffer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 37813220
The first thing that I try to do when working with VBA or .NET equivalent, is to record a macro.

Setting the format for a picture would be:

 Selection.ParagraphFormat.Alignment = wdAlignParagraphRight

Open in new window


You need a reference to the Shape object to set the properties:

With Selection.ShapeRange
   .RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
   .Left = wdShapeCenter
   .WrapFormat.Type = wdWrapTight
   .LockAspectRatio = msoTrue
   .ScaleHeight 0.8, msoTrue
   .ScaleHeight 0.8, msoTrue
End With

Open in new window

0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question