1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
For Each p As Process In Process.GetProcesses
If p.ProcessName = "msaccess" Then
Dim acc As Object = GetObject("Access.Application")
MessageBox.Show(acc.CurrentProject.FullName)
End If
Next
End Sub
Friend Function GetObject(ByVal App As String) As Object
Try
' log.Debug("Begin...")
Return Runtime.InteropServices.Marshal.GetActiveObject(App)
Catch ex As Exception
Return Nothing
'Log.Error("", ex)
Finally
'Log.Debug("End...")
End Try
End Function |
Partager