2013年5月13日月曜日

←←←VBからACCESSのマクロを動かす

Imports System.Data.OleDb
Imports System.Runtime.InteropServices
Imports Microsoft.Office.Interop.Access

Private Sub Button1_Click...
   Dim myPath As String = My.Application.Info.DirectoryPath & "¥***.accdb"
   Dim AccObj As Object = CreateObject("Access.Application")

  With AccObj
     .OpenCurrentDatabase(myPath)
     .DoCmd.RunMacro("マクロ")
     .Quit()
 End With
 AccObj = Nothing
End Sub

0 件のコメント:

コメントを投稿