[AccessD] Demise of VBA

Shamil Salakhetdinov shamil at users.mns.ru
Wed Jul 12 15:28:24 CDT 2006


Hi All,

I think this sample code below would be within the topic of this thread -
try to run this VB.NET MS Word Automation code in VS2005 with a reference
set to the MS Word Primary Interop Assembly - it takes 10+ second just to
start on my PC (and similar VBA code starts MS Word instantly) - I wonder
how quick this VB.NET simple sample works on your PCs? If it will take the
same 10+ second just to start-up will you consider to use VB.NET for MS
Office Automation?

Note: If you use this code with WinForms application then subsequent after 
first MS Word activation calls to start another instance of MS Word will be 
instant but imagine the usual development/testing scenario when you 
start/debug/stop/restart/... your application many times - how about these 
10+ seconds to wait every time you restart your app/debug session? (Or this 
bad side effect happens on my PC only?)

Imports Word = Microsoft.Office.Interop.Word

Module Module1
    Private Function StartApp( _
        ByVal strProgID As String) As Object
        Dim oTmp As Object
        On Error Resume Next

        oTmp = GetObject(, strProgID)
        If Err.Number <> 0 Then
            oTmp = CreateObject(strProgID)
        End If
        StartApp = oTmp
    End Function

    Private Sub TestEarlyBound()
        Dim app As Word.Application
        app = StartApp("Word.Application")
        app.Visible = True
        app.Activate()
    End Sub

    Sub Main()
        Dim ds As DateTime = DateTime.Now
        Dim de As DateTime
        Console.WriteLine("Program started at {0} ", ds.ToString())
        TestEarlyBound()
        de = DateTime.Now
        Console.WriteLine("Program finished at {0} ", de.ToString())
        Console.WriteLine("Press any key to continue...")
        Console.ReadLine()
    End Sub

End Module

Shamil

P.S. When late binding is used then similar VB.NET MS Office Automation code
works instantly here....

----- Original Message ----- 
From: "Susan Harkins" <harkinsss at bellsouth.net>
To: "'Access Developers discussion and problem solving'"
<accessd at databaseadvisors.com>
Sent: Wednesday, July 12, 2006 11:47 PM
Subject: Re: [AccessD] Demise of VBA


> >From a business perspective, it doesn't sound like good judgment does it?
> Why spend the revenue and manpower to replace what you've already got? You
> only need to look to GM to see what happens when you do that.
>
> Susan H.
>
> ...just my opinion of course ...and experience near the top of the food
> chain where evangelists almost always lose to the bottom line ...a bottom
> line that greatly favors a new generation of vba.
>
>
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com




More information about the AccessD mailing list