From: shahnaz fatima on 4 Jul 2010 11:17 i read that matlab functions and commands can be run on ppt. recently there eas a submission on this by sir brett schttsman.in file exchange. from my power point i opened vb editor in that i pasted a function given by him, Sub RunFile(FileName As String, Optional FilePath As String) Dim MATLAB As Object Dim Result As String Dim Command As String Dim MATLABWasNotRunning As Boolean ''''''''''''''''''''''''''''''''''''''''''''''''''' ' Set Up ''''''''''''''''''''''''''''''''''''''''''''''''''' ' Connect to the automation server. ' MATLAB becomes a MATLAB handle to the running instance ' of MATLAB. On Error Resume Next ' Defer error trapping MATLAB = GetObject(, "matlab.application") If Err.Number <> 0 Then MATLABWasNotRunning = True Set MATLAB = CreateObject("matlab.application") Err.Clear ' Clear Err object in case error occurred. End If ''''''''''''''''''''''''''''''''''''''''''''''''''' ' Do the Work ''''''''''''''''''''''''''''''''''''''''''''''''''' If Not IsMissing(FilePath) And Not FilePath = "" Then Command = "cd('" + FilePath + "')" Result = MATLAB.Execute(Command) End If Command = FileName Result = MATLAB.Execute(Command) 'Result = MsgBox("Done", vbOkayOnly, "Click when done") End Sub %%% and then again one subroutine to run our commands or function Sub FILENAME() Call RunFile("COMMANDS TO RUN", "DIRECTORY TO SWITCH TO") End Sub where FILENAME and DIRECTORY TO SWITCH TO I CHANGED according to my path. next step is 4) Link the subroutine to some object, picture, text, etc. that you want to use to trigger the behavior in PowerPoint. (Right-click on the object, select Action Settings, and from the “Mouse Click” tab, select “Run Macro. i dont understand what is this. object is disabled in my vb editor. what to do?????????? anybody can help please.
|
Pages: 1 Prev: remove alternate elements in a vector Next: remove alternate elements in a vector |