1

I'm writing a COM DLL for use in VBA using VB.Net. Here it is, in all its glory:

Public Class CompPl32
    <Runtime.InteropServices.ComVisibleAttribute(True)>
    Public Function MyUncompress(SrcSt As String) As Integer
        Return 0
    End Function
End Class

When I look for this in Excel's VBA editor, I find the dll/tlb with the projectname/rootnamespace "CompPL'. When I refer to it in code though, it's...

Dim pl As CompPl.CompPl32

Which is kind of ugly when you're trying to match the API of non.Net COMs. Is there a way to remove one level of the naming so it's either just CompPl or CompPl32? I tried putting it in a Module but you can't import just the project namespace, it has to have a class name in VBA, and changing the root namespace to nothing results in a blank string that is confusing.

10
  • Nothing related. Just I want to know why the downvoter did not write any comment? Commented Feb 12, 2018 at 20:26
  • I was curious about that myself. Commented Feb 12, 2018 at 20:28
  • Or why even downvote? It seems like a reasonable question, spelling and grammar are good, not an obvious google-able answer, etc... Commented Feb 12, 2018 at 21:41
  • COM references are in the form of LibraryName.ClassName. I have no idea what "Which is kind of ugly when you're trying to match the API of non.Net COMs." means. However, Excel's VBA environment provides an Library lookup analogous to the VB.Net Imports Namespace statement for the Excel and VBA libraries. This feature does not preclude from fully qualifying the reference. If you are using multiple libraries with classes that have the same name as the default imported ones, you have no choice but to do so. i.e. Dim wdApp as Word.Application and Dim xlApp as Excel.Application. Commented Feb 13, 2018 at 0:18
  • @TnTinMn the link appears to state the answer is no, but your statement above that appears to state yes. Do you recall the Library lookup statement you were thinking of? it sounds like what I'm looking for. Commented Feb 13, 2018 at 16:41

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.