Wrox Programmer Forums
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 15th, 2005, 07:33 PM
Registered User
 
Join Date: Feb 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default word 2003 vba

Hey fellow programmers

       I am accessing word 2003 documents through vba. I wanted to programmatically insert / delete watermarks in an already existing document and align the text accordingly; here is the code I got from a macro. I dint get some function details from here could you people help me out


---------------------------Macro code-------------------------

    ActiveDocument.Sections(1).Range.Select
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    Selection.HeaderFooter.Shapes.AddPicture(FileName: = _
        "D:\Documents and Settings\Administrator\Desktop\images\images1.jpg" , _
        LinkToFile:=False, SaveWithDocument:=True).Select
    Selection.ShapeRange.Name = "WordPictureWatermark1"
    Selection.ShapeRange.PictureFormat.Brightness = 0.5
    Selection.ShapeRange.PictureFormat.Contrast = 0.5
    Selection.ShapeRange.LockAspectRatio = True
    Selection.ShapeRange.Height = InchesToPoints(9.86) <---- how in the world did word know the size of the picture in inches
    Selection.ShapeRange.Width = InchesToPoints(7.71)
    Selection.ShapeRange.WrapFormat.AllowOverlap = True
    Selection.ShapeRange.WrapFormat.Side = wdWrapNone
    Selection.ShapeRange.WrapFormat.Type = 3
    Selection.ShapeRange.RelativeHorizontalPosition = _
        wdRelativeVerticalPositionMargin
    Selection.ShapeRange.RelativeVerticalPosition = _
        wdRelativeVerticalPositionMargin
    Selection.ShapeRange.Left = wdShapeCenter
    Selection.ShapeRange.Top = wdShapeCenter
    ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument

-----------------------------end------------------------------

Guys also suggest me how to align the text which is already existing in the document to the center with the watermark







Similar Threads
Thread Thread Starter Forum Replies Last Post
[Word] 2003 VBA - Absolute Row/Col in Tables with geoboater Word VBA 0 August 16th, 2007 07:22 PM
.Net Crystal export to Word 2003 sdca_programmer Crystal Reports 0 January 10th, 2006 09:30 PM
Automatically update all fields [Word 2003] devstylex Access VBA 2 February 2nd, 2005 08:46 AM
Word 2003 bmains ASP.NET 1.0 and 1.1 Professional 0 May 2nd, 2004 06:40 PM
Invoking Word 2003 document from InfoPath 2003 debsoft General .NET 0 April 28th, 2004 08:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.