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 ?
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 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
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.
Sub RunSWMacro()
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)
End Sub
Deepak Gupta are you able to write an Excel file to do this ? sorry for bothering you again