|
-
Aug 20th, 2012, 09:38 AM
#1
Thread Starter
New Member
Dynamically accessing properties
Hi all. This is a VB question, but i'm using part of the Word object model to ask it.
Lets say I have a block of code that normally I would set properties like this:
With Selection.ParagraphFormat
.LeftIndent = 0
.RightIndent = 0
.SpaceBefore = 0
.SpaceBeforeAuto = False
.SpaceAfter = 12
End With
Now lets say I have a database that has the following data in it:
"ParagraphFormat","LeftIndent",0
"ParagraphFormat","RightIndent",0
"ParagraphFormat","SpaceBefore",0
"ParagraphFormat","SpaceBeforeAuto",0
"ParagraphFormat","SpaceAfter",12
and I put that into variable form like
ObjType = "ParagraphFormat"
PropType = "LeftIndent"
PropValue = 0
Is it possible to have reference items dynamically with something similar to
Selection.(ObjType).(PropType) = PropValue
Sorry if this seems obscure. I'm trying to write an application in Word VBA where properties are stored in a database. I don't want to have to have a column for each property type if I can help it.
Thanks in advance.
Jeff
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|