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 :
I have always the same error. It says me :
I realy don't understand why it doesn't work.
Than you !
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
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
But it's still not working...
RE: How to Lunch SAP2000v17 in VBA
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
I change this thanks !
But it's still not workng :(