Solved

Set the type of Style in word (VB.NET)

Posted on 2008-10-20
3
1,335 Views
Last Modified: 2013-11-10
Currently I am developing an addin for word. I need to set the type of a style but it is a read only property and I am unable to set it, anyone help?
Dim oStyle As Word.Style
oStyle = Application.ActiveDocument.Styles.Add("temp")
oStyle = Application.ActiveDocument.Styles("temp")
oStyle.Type = Word.WdStyleType.wdStyleTypeCharacter  <<------------- This is giving me error ! ! !

Open in new window

0
Comment
Question by:KenTan85
3 Comments
 
LVL 23

Accepted Solution

by:
irudyk earned 500 total points
ID: 22795540
The style type is read only in Word.  You need to define it as a character style when you first create it. Try the following to see if it works for you:

Dim oStyle As Word.Style
Set oStyle = Application.ActiveDocument.Styles.Add("temp", Word.WdStyleType.wdStyleTypeCharacter)

Open in new window

0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…

809 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