Solved

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

Posted on 2012-03-30
1
417 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
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
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…

685 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