Connecting Tech Pros Worldwide Forums | Help | Site Map

Accessing COM Object without Interop Assembly Wrapper

Marlon R
Guest
 
Posts: n/a
#1: Mar 9 '06
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



Frank Dzaebel
Guest
 
Posts: n/a
#2: Mar 9 '06

re: Accessing COM Object without Interop Assembly Wrapper


Hi Marlon,
[color=blue]
> I am write an application that will interop with Excel. But the target
> machines all have different version (9,10,11) .[/color]

Look for example at
http://dzaebel.net/LatebindWord.htm (swap Word with Excel)

Its German, but the links are also available in English and the
code I think is readable.


ciao Frank
--
Dipl.Inf. Frank Dzaebel [MCP/MVP C#]
http://Dzaebel.NET
Nicholas Paldino [.NET/C# MVP]
Guest
 
Posts: n/a
#3: Mar 9 '06

re: Accessing COM Object without Interop Assembly Wrapper


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.


--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com

"Marlon R" <yardi4life@online.nospam> wrote in message
news:%23MM$dh4QGHA.5636@TK2MSFTNGP10.phx.gbl...[color=blue]
> 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
>
>[/color]


Closed Thread