The userform is used to generate different medical reports. After the form is
completed and Ok button is clicked, all the variables from the userform are
established and the appropriate report template is added. The very next step
is to execute the following:
InsertBayBrookBillingSheet:
If Clinic$ = "Bay Brook" Then
ReportMacros.Report_Macros_QTC.InsertBayBrookBillingSheet
End If
The code in the macro being called is as follows:
Selection.EndKey Unit:=wdStory
ActiveDocument.Range(Start:=Selection.Start, End:=Selection.Start). _
InsertBreak Type:=wdSectionBreakNextPage
Selection.Start = Selection.Start + 1
With ActiveDocument.Range(Start:=Selection.Start, End:=ActiveDocument. _
Content.End).PageSetup
End With
Selection.Collapse Direction:=wdCollapseEnd
Selection.Style = "Default Paragraph Font"
Selection.InsertFile FileName:="C:\Garvin\Word Templates\DOL
Questions\BaybrookBillingSheet.doc"
However, using the Application.Run MacroName code just inserts the billing
sheet but then stays in the document and does not return to the code to
complete the rest of the program. I have had a problem in the past with using
this type of code. At that time it did return to the program but it skipped
the next few lines of code. So I haven't been able to figure out what is
happening.
I have to admit I'm at a loss here too. Did you try to walk through
your code with F8? Another thing you can try is substitute the call to
the other procedure with local code, just to see where the problem
lies.
Again, I don't understand why your code shouldn't resume after the
call. Maybe someone else has a better idea.
Sorry,
Theo
singeredel - 26 Feb 2005 02:01 GMT
I think I figured out the problem and it had nothing to do with the form of
the code you provided. It had to do with a project that was having problems
with "disabled macros". When that problem was resolved, this seemed to work.
Thanks!
> I have to admit I'm at a loss here too. Did you try to walk through
> your code with F8? Another thing you can try is substitute the call to
[quoted text clipped - 6 lines]
> Sorry,
> Theo
singeredel - 26 Feb 2005 05:29 GMT
I thought my problem was resolved, but when in step mode, using the
"Application.Run MacroName:" won't let me step back into the program after
the macro executes, so I don't know if the rest of the program is executing
correctly.
> I have to admit I'm at a loss here too. Did you try to walk through
> your code with F8? Another thing you can try is substitute the call to
[quoted text clipped - 6 lines]
> Sorry,
> Theo
Theo van der Ster - 26 Feb 2005 07:01 GMT
I'm not sure but I think this is normal behavior for step mode. Find a
way around it just for testing purposes and put some local code in to
fake the results you'd otherwise get from the macro in the other
project.
singeredel - 26 Feb 2005 17:38 GMT
I just ended up putting the code directly in the procedure instead of trying
to call a procedure from another project module. However, it sure would be
nice to know how to do this. The procedure I am trying to call from is in the
Normal project and the procedure being called is in the
ReportMacros.Create_QTC_Report project/module. I have a reference to Normal
in the ReportMacros project because I have to access forms in Normal from
procedures in ReportMacros, but this reference to Normal in ReportMacros
precludes me from setting a reference to ReportMacros in the Normal project,
so I don't know how to be able to have a reciprocal access. I have "Get
Property" statements in the Normal project for Userforms that need to be
accessed, but I apparently cannot use a Get Property to access a module, or I
just don't know how.
> I'm not sure but I think this is normal behavior for step mode. Find a
> way around it just for testing purposes and put some local code in to
> fake the results you'd otherwise get from the macro in the other
> project.