-2

I have run into a problem where I need to use an old API created in VB6 which requires a vba.collection to be used when referencing the API for something.

I can't do this in my .net project as it fails when trying to convert visual.basic.collection to vba.collection.

I have found a workaround but cannot create the vb6 dll as I do not have vb6 and I cannot get hold of a copy.

Below are the steps I need to carry out in VB6, could anyone kindly help me to create this dll so I can complete my project?

Many Thanks!

Create a Visual Basic 6.0 DLL that returns the collection

Create a Visual Basic 6.0 Microsoft ActiveX DLL project. By default, the Class1 class is created.

Rename the project CollectionFactory, and then rename the class clsVBACollection.

Add the following code to the clsVBACollection class.

 ' This function creates a new object of the VBA collection.
Public Function CreateVBACollection() As Collection

   ' Define a variable of type Collection.
   Dim col As Collection

   ' Create a Collection object.
   Set col = New Collection

   ' Return the Collection object.
   Set CreateVBACollection = col
End Function

On the File menu, click Make CollectionFactory.dll.

danieldunn10
  • 81
  • 2
  • 8
  • To solve your problem you need VB6. Do you have it?. –  Sep 23 '16 at 09:43
  • Hi thanks for your reply, I don't have it, I've tried getting hold of it but cant! – danieldunn10 Sep 23 '16 at 09:52
  • Well you need to create a collection in VB6 and pass it to VB.NET to pass back to VB6. –  Sep 23 '16 at 10:43
  • [This answer](http://stackoverflow.com/questions/1766514/any-cheap-or-free-ides-out-there-for-vb6-programming/1766853#1766853) tells you how to get the VB6 IDE. Disclaimer: I wrote it. – MarkJ Sep 23 '16 at 11:45
  • Why are you asking this question again? http://stackoverflow.com/questions/39648299/create-a-vb6-dll-using-visual-studio-2015 – jac Sep 23 '16 at 16:00
  • Hi, I was able to create the dll in the MS article using VB6 and this solved my problem, I hope this hels someone in the future! – danieldunn10 Sep 28 '16 at 06:55

1 Answers1

0

I was able to create the dll in the MS article using VB6 and this solved my problem, I hope this hels someone in the future!

danieldunn10
  • 81
  • 2
  • 8