1

I am trying to start SAP2000 using VBA Excel but I get an error with the message: "Automation Error". The code is very simple:

Sub api()

Dim SapObject As Sap2000.SapObject
Set SapObject = New Sap2000.SapObject
SapObject.ApplicationStart

End Sub

This code should start SAP2000 but it does not.

SAP2000v14 is installed along with Office 2013. I have checked the tick box next to SAP2000 in Tools-References menu.

By the way, I can run SAP2000 using MATLAB.

Thank you!

4
  • Did you try Dim SapObject As New Sap2000.SapObject and omit the Set line? Commented Nov 20, 2014 at 14:38
  • Still I receive the same error. Commented Nov 20, 2014 at 14:41
  • try late binding, have you got reference to the SAP2000 API? Commented Nov 20, 2014 at 14:57
  • what is late binding? i have checked the tickbox next to SAP2000 in tools-references in VBA editor. Commented Nov 20, 2014 at 15:08

2 Answers 2

1

Thank you guys. But I have sorted it out. In the compability options of SAP2000.exe, "run as admin" was selected. So I deselected it and it works now.

Sign up to request clarification or add additional context in comments.

Comments

1

Here is code for SAP 2000:

Option Explicit

  Dim SapObject As SAP2000.SapObject
  Dim ret As Long
  Dim Coordinates As Range
   Sub Sap2000_open()


  ' Create the Sap2000 object

      Set SapObject = CreateObject("SAP2000.SapObject")

      SapObject.ApplicationStart
      SapObject.SapModel.InitializeNewModel (kgf_m_C)
      ret = SapObject.SapModel.File.NewBlank

End Sub

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.