i'm a civil guy and doesn't know anything about scripting but i need this script to integrate mathcad and autocad. i use windows 7 and whenever i run this it says active x component cant create the object. Can someone debug this?
Private Sub ScrollBar1_Change()
If beamExists Then
If checkRules(scrlWidth.Value, beamHeight, beamWebThickness) Then
beamWidth = scrlWidth.Value
UpdateBeam beamWidth, beamHeight, beamWebThickness, solidlength
UpdateMomentandSection beamWidth, beamHeight, beamWebThickness
Else
scrlWidth.Value = beamWidth
End If
End If
End Sub
Private Sub cmdCreateBeam_Click()
' Call the greatly modified createIBeam function
createTBeam MCapp, WS
End Sub
Private Sub cmdQuit_Click()
' Unload the form (also calls Terminate event code)
MCapp.Quit 2
Unload Me
End Sub
Private Sub CommandButton1_Click()
Dim ObjFSO As Object
Dim okPushed As Boolean
Dim FileName As String
Set ObjFSO = CreateObject("UserAccounts.CommonDialog")
ObjFSO.Filter = "Mathcad|*.xmcd|Text Documents|*.txt|All Files|*.*"
ObjFSO.FilterIndex = 3
ObjFSO.InitialDir = "c:\"
okPushed = ObjFSO.ShowOpen
If okPushed = False Then
FileName = "null"
Else
FileName = ObjFSO.FileName
End If
'Test and see if Mathcad is already running, if so attach to it, otherwise start Mathcad
On Error Resume Next
Err.Number = 0
Set MCapp = GetObject(, "Mathcad.Application")
If Err.Number <> 0 Then
Set MCapp = CreateObject("Mathcad.Application")
End If
On Error GoTo 0
'Show the Mathcad Application and load the T-Beam worksheet
MCapp.Visible = True
Set WS = MCapp.Worksheets.Open(FileName)
End Sub
Private Sub CommandButton1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
End Sub
Private Sub CommandButton2_Click()
RemoveBeam
End Sub
Private Sub UserForm_Terminate()
' Cleanup
Set solidObject = Nothing
' Delete our blockobject, if it exists
Dim entry As Object
For Each entry In ThisDrawing.Blocks
If entry.Name = "LINEBLOCK" Then
lineBlock.Delete
End If
Next
' Reset the logic
beamExists = False
End Sub
Private Sub ScrollBar1_Change()
If beamExists Then
If checkRules(scrlWidth.Value, beamHeight, beamWebThickness) Then
beamWidth = scrlWidth.Value
UpdateBeam beamWidth, beamHeight, beamWebThickness, solidlength
UpdateMomentandSection beamWidth, beamHeight, beamWebThickness
Else
scrlWidth.Value = beamWidth
End If
End If
End Sub
Private Sub cmdCreateBeam_Click()
' Call the greatly modified createIBeam function
createTBeam MCapp, WS
End Sub
Private Sub cmdQuit_Click()
' Unload the form (also calls Terminate event code)
MCapp.Quit 2
Unload Me
End Sub
Private Sub CommandButton1_Click()
Dim ObjFSO As Object
Dim okPushed As Boolean
Dim FileName As String
Set ObjFSO = CreateObject("UserAccounts.CommonDialog")
ObjFSO.Filter = "Mathcad|*.xmcd|Text Documents|*.txt|All Files|*.*"
ObjFSO.FilterIndex = 3
ObjFSO.InitialDir = "c:\"
okPushed = ObjFSO.ShowOpen
If okPushed = False Then
FileName = "null"
Else
FileName = ObjFSO.FileName
End If
'Test and see if Mathcad is already running, if so attach to it, otherwise start Mathcad
On Error Resume Next
Err.Number = 0
Set MCapp = GetObject(, "Mathcad.Application")
If Err.Number <> 0 Then
Set MCapp = CreateObject("Mathcad.Application")
End If
On Error GoTo 0
'Show the Mathcad Application and load the T-Beam worksheet
MCapp.Visible = True
Set WS = MCapp.Worksheets.Open(FileName)
End Sub
Private Sub CommandButton1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
End Sub
Private Sub CommandButton2_Click()
RemoveBeam
End Sub
Private Sub UserForm_Terminate()
' Cleanup
Set solidObject = Nothing
' Delete our blockobject, if it exists
Dim entry As Object
For Each entry In ThisDrawing.Blocks
If entry.Name = "LINEBLOCK" Then
lineBlock.Delete
End If
Next
' Reset the logic
beamExists = False
End Sub