Hi All,
I am trying to craete a userform in my word document, so that when the user
clicks on a button the form will appear displaying Appendix 1 (a section),
of the current document.
(The idea is that when a person is answering questions in the document, they
are supposed to read various appendices before answering the questions)
I was going to use a rtf control (RICHTX32.OCX) on my form but when I try
and add this to the user form I get the message "The subject is not trusted
for the specified action".
I tried using the DHTMLSafe control with the following code
pBookMark.Range.Sections(1).Range.Select
frmShowSchedule.txtNote.Text = Selection.Text
but the text was not displayed correctly.
Any suggestions?
TIA
Tony
Tony Strazzeri - 24 Mar 2008 23:32 GMT
Hi Tony,
I don't think this is easily done. The problem with the RTF control
is a known one. It is caused by MS trying to restrict the possibility
that thr control could be used to run malicious code. I have in fact
removed the use of the control from several template applications I
created for a client beause it the problem. Although there is a
workaround to allow thr RTF to note generate -it involves a registry
entry change-- the error, I was finding that the change was often
undone by many regular MS updates. The IT dept would roll something
out and not realise that it "broke" the fix and I would get people
complaining that my templates were broken. Anyway this does not
directly address your need.
Have you considered something along the lines of opening the document/
Appendix in a separate document/window?
The following code does this. You may need to play around with the
windows sizes and positions depending on the size of your display
hardware.
Hope this helps.
Cheers!
TonyS.
Dim thiswindow As Window
Set thiswindow = Application.ActiveWindow
NewWindow
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("Appendix")
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Windows.Arrange ArrangeStyle:=wdTiled
Application.Resize Width:=540, Height:=678
Application.Move Left:=540, Top:=2
thiswindow.Activate
Application.Move Left:=0, Top:=0
Application.Resize Width:=540, Height:=675