Re: How to call or run a NB file in another NB file?
- To: mathgroup at smc.vnet.net
- Subject: [mg90779] Re: How to call or run a NB file in another NB file?
- From: Robert Paynter <robert.paynter at gmail.com>
- Date: Thu, 24 Jul 2008 04:51:26 -0400 (EDT)
- Organization: University Of Oxford, England
- References: <g670o5$s4g$1@smc.vnet.net>
Leo.Chen wrote:
> I met a problem, in ABC.nb , I need to run XYZ.nb, is there any
> function to execute the XYZ.nb in ABC.nb?
Make the vital lines in XYZ.nb "Initialization" cells then
save it to create XYZ.m this can now be run with the "Get"
or "Needs" function as a Package
<<XYZ`
you will probably want it in the same directory as your current
notebook; Mathematica won't look there unless you tell it; I find
this useful for doing that - the current notebook (ABC.nb in your
case) needs to have been saved.
SetDirectory[ToFileName@("FileName"/.NotebookInformation[EvaluationNotebook[]]/.{"FileName"->""})[[1]]]
Robert