Run Macro In MS Access from vb.net

Good Morning! Well last night was uneventful which……….I am ok with! Moving, kids, vacation planning, job stuff…..it was time to just sleep.

Anyway, I want to run a macro in an MS Access application from a vb.net application. Not complicated stuff but it is what I have for today. Have a great weekend!

Private Sub RunMacro(ByVal sMacro As String)
        Dim oAccess As Object
        oAccess = CreateObject("Access.Application")
        ‘ Open the database
        oAccess.OpenCurrentDatabase(fsDBName)
        Try
            oAccess.DoCmd.RunMAcro(sMacro)
            oAccess.DoCmd.Maximize()
            oAccess.Visible = True
        Catch e As Exception
            MsgBox("Macro is cancelled or does not exist")
        Finally
            oAccess = Nothing
        End Try
    End Sub

Consulting Requests

Feedback

Blog Front Page

Technorati Tags: ,,,,,,,,,

Windows Live Tags: vb.net,.NET Framework,csharp,Macro,Microsoft,Access,vacation,CreateObject,Application,database

 

Advertisements
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: