Calling a Microsoft Access Function

You can run a built-in Microsoft Access function from Microsoft Excel through Automation. The example procedure below calls the EuroConvert function to convert 1000 Spanish pesetas to a Euro dollar. The EuroConvert function uses fixed conversion rates established by the European Union.

Sub RunAccessFunction() Dim objAccess As Object On Error Resume Next Set objAccess = GetObject(, "Access.Application") 'if no instance of Access is open, create a new one If objAccess Is Nothing Then

Set objAccess = CreateObject("Access.Application") End If

objAccess.EuroConvert(1000, "ESP", "EUR") &_ " euro dollars. " Set objAccess = Nothing End Sub

0 0

Post a comment