Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 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 August 29th, 2005, 05:18 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default adding Header in Word

I get the following code from MSDN http://msdn.microsoft.com/library/de...lbasicnetc.asp tp add a header to my Word Doc but it gives error!

Code:
ThisApplication.ActiveDocument.Sections[1].Headers[Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Text = "Header text";
Any idea?!

Always:),
Hovik Melkomian.
__________________
Always,
Hovik Melkomian.
 
Old August 29th, 2005, 06:31 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

U seem to be playing a lot with office programming Melvik.

For this piece of code, I just added it in between one of the previous
pieces of code that i posted in response to an earlier query of yours and it
worked fine.

I'm gonna have to ask you again to post the exact error you are getting and I may be able to help you.

Regards
Ankur Verma
 
Old August 29th, 2005, 07:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

Well Im developing an Office Automation App. & I use Office there.

Did u run my posted code?!
It gives me error that Cannot apply indexing with [] to an expression of type 'Word.Sections'

Tnx 4 ur time.

Always:),
Hovik Melkomian.
 
Old March 15th, 2007, 07:26 PM
Registered User
 
Join Date: Mar 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You need to use parens () not square brackets []





Similar Threads
Thread Thread Starter Forum Replies Last Post
Output Word WITH Template or Header Graphic Ron Howerton ASP.NET 2.0 Professional 1 October 31st, 2007 03:18 PM
Inserting an image in the header of a word documen Michael109 Access 3 April 4th, 2007 11:26 AM
adding word wrap to test output to a report hbenditsky Visual Basic 2005 Basics 0 February 5th, 2006 06:46 PM
Modify header and footer of word file in ASP Andraw Classic ASP Basics 1 January 14th, 2005 08:04 PM
Regarding Word header and footer Hari_Word General .NET 0 November 19th, 2004 06:22 AM





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