Opens an existing Multisim circuit file.

Syntax


Function OpenFile( _
    ByVal filename As String) _
    As MultisimCircuit

Parameters

filename—Name of a Multisim (*.ms8 or higher) file to open.

Remarks

On a successful call, a MultisimCircuit object, corresponding to the opened circuit, is returned. If the filename is invalid or the file cannot be opened, an error occurs. Only *.ms8, or greater files are supported by the API, not project files or other types of files, such as netlists.

This method is a synchronous call, so it may take a few seconds to complete.

Only one circuit may be opened at a time. If a file is already open in Multisim, then it will be closed automatically before the new one is opened. Note that any MultisimCircuit objects referring to the closed circuit will become unusable. To avoid inadvertently trying to access invalid memory, it is a good idea to set pointers to null when finished with them.

When creating a circuit to be used with the Automation API, probes should be included at appropriate output nodes. Otherwise, there is no way to retrieve simulation results.

Example


Dim MSApp As New MultisimInterface.MultisimApp
Dim Circuit As MultisimInterface.MultisimCircuit

Dim strFileName As String
Set strFileName = "C:\circuits\ClassBPushPullAmp.ms14"

On Error GoTo ErrorHandler

    Circuit = MSApp.OpenFile(strFileName)

ErrorHandler:
    MsgBox "Unable to open circuit file" & vbCr & Circuit.LastErrorMessage