×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

How to Lunch SAP2000v17 in VBA

How to Lunch SAP2000v17 in VBA

How to Lunch SAP2000v17 in VBA

(OP)
Hi !
I'm using Excel and I want to lunch SAP2000v17 with it but I have a problem with my code. Here is it :

CODE --> VBA

Option Explicit

Dim SapObject As SAP2000v17.cOAPI
Dim sapmodel As cSapModel
Dim ret As Long

Sub ouvrir_fichier()


Dim nom_fichier As String
Dim chemin As String
Dim kN_m_C As String

Set SapObject = CreateObject("CSI.SAP2000.API.SapObject")

ret = SapObject.ApplicationStart()


ret = SapObject.sapmodel.InitializeNewModel

chemin = Sheets(1).Range("chemin").Value
nom_fichier = Sheets(1).Range("nom_fichier").Value
ret = SapObject.sapmodel.File.OpenFile(chemin & "\" & nom_fichier & ".bdb")
ret = SapObject.sapmodel.SetPresentUnits(kN_m_C)

End Sub 

I have always the same error. It says me :

Quote:

Execution error '429'
An ActiveX component can't create an Object.

I realy don't understand why it doesn't work.

Than you !


RE: How to Lunch SAP2000v17 in VBA

Did you reference SAP2000v17.DLL or SAP2000v17.TLB from your application?
If using Excel VBA, reference SAP2000v17.TLB by opening the VBA editor, clicking the Tools menu > References command and selecting SAP2000v17.TLB from the program installation folder.

RE: How to Lunch SAP2000v17 in VBA

(OP)
Yes I'm using Excel and I refere the SAP2000v17.TLB.

But it's still not working...

RE: How to Lunch SAP2000v17 in VBA

Hi,

1. ret = SapObject.sapmodel.File.OpenFile(chemin & "\" & nom_fichier & ".bdb"), This should be .sdb.
2. Remove reference to previous versions, if any.

Cheers!

RE: How to Lunch SAP2000v17 in VBA

(OP)
Hi !

I change this thanks !

But it's still not workng :(

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources