Vb.net to C# conversion (late binding problem)

Hi ,

I need the convert the attach module in C#.

The problem is only the 'late binding'.

There is a way to solve this problem ?

Thank You !
ModuloWord.txt
luca345Asked:
Who is Participating?
 
BuggyCoderConnect With a Mentor Commented:
the link that i post in my previous post, tells you how to open word doc from a c# application.
Try to follow and see if it helps....
0
 
BuggyCoderCommented:
can you highlight the section where there is problem???
0
 
luca345Author Commented:
The atteched module works 100% but I need to convert it in C#.

The problem is

//
1:      ObjWord = CreateObject("Word.Application")
//

and then this:

//
 Public Sub Word_Open(ByRef ObjWord As Object, ByVal FileInput As String)
//

C# don't support  'late binding'.


//  

 Public Sub Word_Open(ByRef ObjWord As Object, ByVal FileInput As String)

        '/////////////////////////////////////////////////////////////
        '/////////// Create Word object and open the file ////////////
        '/////////////////////////////////////////////////////////////

1:      ObjWord = CreateObject("Word.Application")

        ObjWord.Documents.Open(FileInput)

    End Sub

//
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
BuggyCoderCommented:
0
 
luca345Author Commented:
Hi BuggyCoder,

Convert a code is not a problem.

Here there is a concept that is different from VB.net and C#.

There is not automatic converted that can solve the problem, only a human can solve this.
0
 
BuggyCoderCommented:
well in c# you can use System.VisualBasic namespace and call
var objWord = Interaction.CreateObject("Word.Application") as Word.Application;

see this for reference:-
http://www.c-sharpcorner.com/UploadFile/amrish_deep/WordAutomation05102007223934PM/WordAutomation.aspx
0
 
luca345Author Commented:
Yes teorically is possible but I like to programmin in C# and I don't want use a VB reference.

And apart this when I will try do import it in monoproject vb 'createobject' is not supported.
0
 
luca345Author Commented:
Thank you !
0
All Courses

From novice to tech pro — start learning today.