Hi,

Yes it should work, but I don't have the correct assembly to be able to test it.

You should remember that you should just translate the code from VB to IronPython. IronPython is a dynamically bound language, so you don't have to do things like declaring the local variable oWord (i.e. 'oWord = wordApp.ApplicationClass')

In python an variable object is bound to a type upon assignment to an Rvalue object

If you tell me how to get the assembly having "Microsoft.Office.Interop.Word" I will try it out for you and post back the code snippet.

Anthony

On 5/9/05, kbond <[EMAIL PROTECTED]> wrote:
Hello,

First congratulation of all, thank you for the tremendous work that you
have already done.
I am looking forward the day where I will be able to translate all my MS
office  automation in python  scripts.

Am I correct I say that iron python will allow it?

So today I try to give it a try but unfortunatly withou success till now.
I am trying to translate this simple vb.net module to iron python, is
there someone reading this list that can help me?

the VB

Imports word = Microsoft.Office.Interop.word
Module Module1

    Sub Main()
        Dim oWord As Word.ApplicationClass

        'Start Word and open the document.
        oWord = CreateObject("Word.Application")
        oWord.Visible = True
        oWord.Documents.Open("C:\tmp\Doc1.doc")

        'Run the macros.
        'oWord.Run("DoKbTest")
        'oWord.Run("DoKbTestWithParameter", "Hello from VB .NET Client")

        'Quit Word.
        oWord.Quit()
        System.Runtime.InteropServices.Marshal.ReleaseComObject(oWord)
        oWord = Nothing

    End Sub

End Module

Iron Python

import sys
sys.LoadAssemblyByName("Microsoft.Office.Interop.Word")
import Microsoft.Office.Interop.Word as wordApp
oWord = wordApp.ApplicationClass

oWord = CreateObject("wordApp.Application")
oWord.Visible = True
oWord.Documents.Open("C:\tmp\Doc1.doc")

oWord.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComObject (oWord)
oWord = Nothing

thank you

_______________________________________________
users-ironpython.com mailing list
users-ironpython.com@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

_______________________________________________
users-ironpython.com mailing list
users-ironpython.com@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to