S
sylvian stone
Hi,
What I am attempting to do is probably very easy - but can't seem to
figure out.
Within a document, I use controls to insert other mini documents into
the document at specified bookmarks. However, some of these are using
different fonts, or they just don't come accross correctly.
Therefore, I defined a new Style (reportStyle) which I want to apply to
any new text that I import.
However, I just can't manage to achieve this. I think the main point I
am probably missing is to extend the range to the end of the text that
I have just inserted, then apply the style. I suspect all I am doing is
apply a style to a bookmark.
Any suggestions ?
Rgds
SS.
---------------Code Snippet Below -------------------
Dim myRange As Range
'Set Attitude to Investment Risk Paragraph
Set myRange = objDoc.Bookmarks("detailed_recommendations").Range
myRange.Style = objDoc.Styles("reportStyle")
Dim cCont As Control
Dim tempCntl As String
Dim tempCntlprovider As String
myRange.Style = objDoc.Styles("reportStyle")
For Each cCont In Me.Controls
'MsgBox TypeName(cCont) & " - " & cCont.Name
If TypeName(cCont) = "CheckBox" Then
If cCont.value = True Then
tempCntl = cCont.Name
tempCntlprovider = cCont.Name & "_provider"
If Me.Controls(tempCntlprovider).ListIndex <> 0 Then
myRange.InsertFile providerpath &
Me.Controls(tempCntlprovider).value & ".doc"
myRange.InsertFile detpath & tempCntl & ".doc"
myRange.Style = objDoc.Styles("reportStyle")
End If
End If
End If
Next cCont
What I am attempting to do is probably very easy - but can't seem to
figure out.
Within a document, I use controls to insert other mini documents into
the document at specified bookmarks. However, some of these are using
different fonts, or they just don't come accross correctly.
Therefore, I defined a new Style (reportStyle) which I want to apply to
any new text that I import.
However, I just can't manage to achieve this. I think the main point I
am probably missing is to extend the range to the end of the text that
I have just inserted, then apply the style. I suspect all I am doing is
apply a style to a bookmark.
Any suggestions ?
Rgds
SS.
---------------Code Snippet Below -------------------
Dim myRange As Range
'Set Attitude to Investment Risk Paragraph
Set myRange = objDoc.Bookmarks("detailed_recommendations").Range
myRange.Style = objDoc.Styles("reportStyle")
Dim cCont As Control
Dim tempCntl As String
Dim tempCntlprovider As String
myRange.Style = objDoc.Styles("reportStyle")
For Each cCont In Me.Controls
'MsgBox TypeName(cCont) & " - " & cCont.Name
If TypeName(cCont) = "CheckBox" Then
If cCont.value = True Then
tempCntl = cCont.Name
tempCntlprovider = cCont.Name & "_provider"
If Me.Controls(tempCntlprovider).ListIndex <> 0 Then
myRange.InsertFile providerpath &
Me.Controls(tempCntlprovider).value & ".doc"
myRange.InsertFile detpath & tempCntl & ".doc"
myRange.Style = objDoc.Styles("reportStyle")
End If
End If
End If
Next cCont