BBRAZEAU
Mechanical
- Jun 29, 2001
- 3
Greetings I have written a program in excell that creates parts in solidworks based on user input to a form in excell.
I would like to start this excell file with a macro button in solidworks.I have found an old post in this forum that had info on this.The thread said this code:
' ******************************************************************************
' C:\DOCUME~1\BBrazeau\LOCALS~1\Temp\swx1216\Macro1.swb - macro recorded on 12/20/01 by BBrazeau
' ******************************************************************************
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long
Dim Annotation As Object
Dim Gtol As Object
Dim DatumTag As Object
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Dim Workbooks As Object
Dim Filename As Object
Sub main()
Set swApp = CreateObject("SldWorks.Application"
* Workbooks.Open Filename:="C:\Book1.xls", ReadOnly:=True
* Workbooks.Application.Visible = True
'Change a cell
Range("B2".FormulaR1C1 = sEqn
* Workbooks.Close
End Sub
or at least the 3 lines Preceeded by"*" would do the trick,but when I run this macro I get "Object or withblock variable not set"
I have included the excell object libary in the macro under tools refs.
Any ideas? I would really like this macro to be able to open my excell file .It would give my program a polished feel. : )
I would like to start this excell file with a macro button in solidworks.I have found an old post in this forum that had info on this.The thread said this code:
' ******************************************************************************
' C:\DOCUME~1\BBrazeau\LOCALS~1\Temp\swx1216\Macro1.swb - macro recorded on 12/20/01 by BBrazeau
' ******************************************************************************
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long
Dim Annotation As Object
Dim Gtol As Object
Dim DatumTag As Object
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Dim Workbooks As Object
Dim Filename As Object
Sub main()
Set swApp = CreateObject("SldWorks.Application"
* Workbooks.Open Filename:="C:\Book1.xls", ReadOnly:=True
* Workbooks.Application.Visible = True
'Change a cell
Range("B2".FormulaR1C1 = sEqn
* Workbooks.Close
End Sub
or at least the 3 lines Preceeded by"*" would do the trick,but when I run this macro I get "Object or withblock variable not set"
I have included the excell object libary in the macro under tools refs.
Any ideas? I would really like this macro to be able to open my excell file .It would give my program a polished feel. : )