S
sylvian stone
Hi,
I'm currently working with a back-office system that does a lot of its
reporting via Word VBA Macros. However, I need to extend the
functionality.
What I did was create a new template, add a user form, and use code to
drag in mini-templates containing text and mergefields to specified
bookmarks, depending on which options the user selects on the form.
This is pretty basic stuff, but my main problem lies in the fact that
if I open the main document as a template, there is no problem.
However, if the main document is opened as a document, I get the
following error:
"Class does not support automation or does not support expected
interface."
Looking through the docs, it suggested that this is an MDAC problem.
Having installed a new MDAC, it has made no difference.
Am I missing something basic here:
The main code that drags the template (or word document - I've tried
both) into the main template / document is:
Sub check_path()
path = "E:\1stdir32\Letter\Financial Plan - LBFP\"
End Sub
Private Sub hide_form_Click()
report_options.Hide
End Sub
Private Sub render_Click()
check_path
Dim myRange As Range
Set myRange =
ActiveDocument.Bookmarks("investment_risk_paragraph").Range
myRange.InsertBreak wdSectionBreakNextPage
myRange.InsertFile path & "attitude_to_investment_risk.doc"
End Sub
Thanks for any advice.
SS.
I'm currently working with a back-office system that does a lot of its
reporting via Word VBA Macros. However, I need to extend the
functionality.
What I did was create a new template, add a user form, and use code to
drag in mini-templates containing text and mergefields to specified
bookmarks, depending on which options the user selects on the form.
This is pretty basic stuff, but my main problem lies in the fact that
if I open the main document as a template, there is no problem.
However, if the main document is opened as a document, I get the
following error:
"Class does not support automation or does not support expected
interface."
Looking through the docs, it suggested that this is an MDAC problem.
Having installed a new MDAC, it has made no difference.
Am I missing something basic here:
The main code that drags the template (or word document - I've tried
both) into the main template / document is:
Sub check_path()
path = "E:\1stdir32\Letter\Financial Plan - LBFP\"
End Sub
Private Sub hide_form_Click()
report_options.Hide
End Sub
Private Sub render_Click()
check_path
Dim myRange As Range
Set myRange =
ActiveDocument.Bookmarks("investment_risk_paragraph").Range
myRange.InsertBreak wdSectionBreakNextPage
myRange.InsertFile path & "attitude_to_investment_risk.doc"
End Sub
Thanks for any advice.
SS.