Accessing COM Object without Interop Assembly Wrapper

  • Thread starter Thread starter Marlon R
  • Start date Start date
M

Marlon R

Is there a way to access COM object like VB.NET when Option Strict is set to
Off.

I am write an application that will interop with Excel. But the target
machines all have different version (9,10,11) .
Option Strict Off

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim o As Object = GetObject("")

o.GetName()

End Sub

End Class
 
Marlon,

Well, yes. Use VB and turn option strict off. This is exactly how I
would handle this particular situation, since using reflection in C# to do
it is a PITA.

Create an assembly in VB that exposes your functionality (which performs
the work of accessing Excel) and then reference that from your project.

Hope this helps.
 
Back
Top