Hi Klaus;
This is my(S.R.) and it might not to be the best but it works.
What I am trying to do is this:
| a |
| ---- |
| b |
|------ | =
| c |
My left,right barackets and with my expressions inside, my question was
shoul I draw my barackets first then write the expressions after or code as
I draw the brackets .
Please be free to make any corrections or re-write the whole thing!
Public Function RBracketW(Optional addHeight As Integer)
Dim myPara As Object
Dim xx As Integer
On Error GoTo RBracketW_Error
Set myPara = oWord.Selection.Paragraphs
With oWord.Selection
oWord.Selection.Font.bold = False
If addHeight <> 0 Then
oWord.Selection.InsertSymbol CharacterNumber:=246, Font:="Symbol",
Unicode:=True
oWord.Selection.TypeText vbCr
'/For Each myPara In Selection.Paragraphs
With myPara.Format
For xx = 1 To addHeight
.LineSpacingRule = wdLineSpaceExactly
.LineSpacing = oWord.Selection.Range.Characters.First.Font.SIZE
oWord.Selection.InsertSymbol CharacterNumber:=231,Font:="Symbol",
Unicode:=True
oWord.Selection.TypeText vbCr
Next xx
End With
'/Next myPara
oWord.Selection.InsertSymbol CharacterNumber:=248, Font:="Symbol",
Unicode:=True
Else
'No additional height
.InsertSymbol CharacterNumber:=246, Font:="Symbol", Unicode:=True
.Paragraphs.Format.LineSpacingRule = wdLineSpaceExactly
.Paragraphs.Format.LineSpacing =
oWord.Selection.Range.Characters.First.Font.SIZE
oWord.Selection.TypeText vbCr
.InsertSymbol CharacterNumber:=248, Font:="Symbol", Unicode:=True
End If
End With
oWord.Selection.Font.bold = False
On Error GoTo 0
Exit Function
RBracketW_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
RBracketW of Module qstrGen2"
Resume Next
End Function
Regards
Kol
"Klaus Linke"
news:OL9r7%23BkIHA.2304@TK2MSFTNGP05.phx.gbl...
>> So I have the parentheses build say four or five symbols deep. How
>> do I navigate in otherwords, set the cursor position to each level from
>> vb?
>> Or do I write my code as I build the parentheses ?
>
> I'm not sure what your document looks like, and what you try to do with
> the macro.
>
> You probably know already, but you can position the parentheses/accolades
> with a tab.
>
> BTW, setting the line spacing to equal the font size was pretty stupid.
> Usually it would make more sense to set the font size of the symbols to
> the line spacing (although you still should use a line spacing of
> "exactly").
> Else it would botch other text you might have in that paragraph.
>
> It isn't done so easily by macro, because Word has problems telling the
> font for symbols that you have inserted through "Insert > Symbol". So you
> have to get the font through the dialog:
>
> ' Select the text in which you want to fix the Symbol brackets...
> ' The macro then sets the font size of all symbols in the selection to
> equal the line spacing,
> ' and sets the line spacing rule to "exactly".
> Dim myRange As Range
> Dim myChar As Range
> Set myRange = Selection.Range.Duplicate
> Dim dlg As Dialog
> Set dlg = Dialogs(wdDialogInsertSymbol)
> For Each myChar In myRange.Characters
> myChar.Select
> dlg.Update
> If dlg.Font = "Symbol" Then
> Debug.Print dlg.Tab, Hex(dlg.CharNum And &HFFFF&), dlg.CharNumLow,
> dlg.Unicode, dlg.Hint
> myChar.Font.Size = myChar.Paragraphs(1).LineSpacing
> myChar.Paragraphs(1).LineSpacingRule = wdLineSpaceExactly
> End If
> Next myChar
> myRange.Select
>
> Regards,
> Klaus
>
>