Solved

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

Posted on 2012-03-28
8
350 Views
Last Modified: 2012-06-27
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
0
Comment
Question by:luca345
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 20

Expert Comment

by:BuggyCoder
ID: 37776721
can you highlight the section where there is problem???
0
 

Author Comment

by:luca345
ID: 37776764
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
 
LVL 20

Expert Comment

by:BuggyCoder
ID: 37776787
0
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 

Author Comment

by:luca345
ID: 37776805
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
 
LVL 20

Expert Comment

by:BuggyCoder
ID: 37776871
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
 

Author Comment

by:luca345
ID: 37776910
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
 
LVL 20

Accepted Solution

by:
BuggyCoder earned 500 total points
ID: 37776927
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
 

Author Closing Comment

by:luca345
ID: 37776964
Thank you !
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question