Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Invalid use of New Keyword on StarTeam COM object

Status
Not open for further replies.

markburke10

Programmer
Dec 23, 2011
1
US
I am new with VBA. I get the error Invalid use of New Keyword on statement "set si = New StarTeam.StServerInfo"

If I remove the set statement, then I get the error Object variable or With block variable not set, on the statement "si.setPort (12345)"

The latter removal indicates to me that the si object must be created with a set ... new object statement. However when I do that, I get the invalid use of New Keyword.

Here is my procedure

Sub Macro1()

Dim strAddress As String
Dim nPort As Integer
Dim strUserName As String
Dim strPassword As String
Dim x As Integer
Dim p As StarTeam.StProject
Dim v As StarTeam.StView
Dim f As StarTeam.StFolder
Dim si As StarTeam.StServerInfo
Dim s As StarTeam.StServer

x = 0

Set si = New StarTeam.StServerInfo '<<New error

si.setPort (12345) '<<if no new stmt, object with error
si.setUserName ("name")
si.Password = "xxxxx"
si.Address = "server.com"

s.Connect

End Sub

I am using a com object dll called "StarTeam Library", referring to c:\program files (x86)\Borland\StarTeam SDK 10.4\lib\StarTeamSDK104.dll

Its interface is documented at

Help is appreciated, thank you very very much.
 
Have you tried this ?
Set si = CreateObject("StarTeam.StServerInfo")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Um ... I don';t think that StarTeam's Java interfaces work inquite the same way with VBA. I think you need to be looking at StarTeam's Factory objects

So yopu have to take an additional step, something like:

Dim si As StarTeam.StServerInfo
Dim sif As StarTeam.StServerInfoFactory

Set sif = New StarTeam.StServerInfoFactory
Set si = sif.Create() ' you may need to check the StarTeamSDK tool library for the correct usage here

This has the advantage that you should be able to use any of the defined constructor methods, especially those requiring parameters (something you cannot normally do with simple VBA class instantiation)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top