Is it possible to create a macro in Excel , once I click it , it will : start Solidworks and automatically run the macro stored in "C:\Desktop\Sld" then closes everything leaving the excel worksheet open ?
If so can any kind soul please help ?
Deepak Gupta are you able to write an Excel file to do this ? sorry for bothering you again
It is possible but I got to ask why. There is api function for the document manager which enables you to edit some of the data of the SW files without opening them in SW.
That method is way quicker than loading SW and open the file.
What purpose you're looking to solve via running the macro from Excel?
Deepak Gupta Because I already have another macro that will get the files from a folder and passte them as hyperlink , my purpose is to combine these 2 macros together so that I can , convert the drawings and save into specified folder , and paste them as hyperlink
OK, why you need another macro and why not do that in one. Any chance if you can share that macro to look at?
I just need the excel to start solidworks , run the solidworks macro , finish the job , closes Solidworks and call out the excel sub to paste them as hyperlinks .The solidworks macro is the one u wrote for me last time if you remember . Deepak Gupta
same requiremnt for my project
I did it this way using RunMacro2. This is code inside of Excel that runs a Solidworks Macro. This is the only code that resides in Excel. Call out path of macro, module name,macro name. Assign this macro to something in Excel and click it.
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim RunMacroError As Long
Dim boolstatus As Boolean
Set swApp = CreateObject("SldWorks.Application")
Set swModel = swApp.ActiveDoc
boolstatus = swApp.RunMacro2("C:\Users\bunner\OneDrive - Sealed Air Corporation\Computer\Desktop\Active Templates\Fagerdala Windshield Template - Rev 1.3 Not for Distrubution\Windshield Template 1.3.swp" _
, "modMain", "main", 0, RunMacroError)
Retrieving data ...