I am trying to write a macro that will test if the open file is read only and if so it will do something but I can't get it to work. As I step thru the code I get to "ReadWariteState = swModel.IsOpenedReadOnly()" and that is working (if the file is read only it is true, if not it is false) but when I try to test if that is true It skipped to the else when it should have done the then. What am I doing wrong?
Thanks,
David
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim ReadWariteState As Boolean
Sub main()
'connect to SolidWorks and the active document
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
ReadWariteState = swModel.IsOpenedReadOnly()
If ReadWariteState = True Then
MsgBox "test"
Else
Exit Sub
End If
End Sub