[AccessD] Trying to open Access invisibly not working

Bill Benson bensonforums at gmail.com
Fri Mar 6 21:40:34 CST 2015


Do you really need access to do the heavy lifting, or just hold data (ie,
act as a back end). If not, you could use ADO.
On Mar 3, 2015 12:42 PM, <ewaldt at gdls.com> wrote:

> I have written some code in Excel VBA that opens Access, creating a link
> in Access to a sheet in the current workbook in Excel, has Access run some
> a VBA procedure I've written there, and then closes Access. It all works
> great except one thing: Access insists on showing its smiling face in the
> process. Now I admit that it's doing the heavy lifting in this, but I
> don't want my users to freak out when it shows up.
>
> Here's the code that calls Access and closes it:
>
> '-------------------
> Dim accObj As Object, strFile As String
>
> 'Open Access and run subroutine
>     strFile = ActiveWorkbook.Path & "\" & ActiveWorkbook.Name
>     Set accObj = CreateObject("Access.Application")
>
>     With accObj
>         .Application.Visible = False            'This does nothing
>         .OpenCurrentDatabase [This is where I put the full path to the
> database]
>         Application.ScreenUpdating = True
>         Application.ScreenUpdating = False
>         .Run "LinkCPL", strFile, "SourceData", "A1:B" & lngLastRow
>         .CloseCurrentDatabase
>     End With
>
>     Set accObj = Nothing
> '--------------------
>
> From what I've read, OpenCurrentDatabase opens Access in an Access window,
> which is where the problem comes in. I tried minimizing Access from within
> the code procedure (LinkCPL) by opening it with the following code from
> Microsoft.com:
> '-----------
>         DoCmd.Minimize
>         DoCmd.RunCommand acCmdAppMinimize
> '-----------
>
> It minimizes the database, but not the app! The background of the window
> stays there. Since I have screen updating turned off in Excel during the
> procedure, I thought maybe Access was actuallly minimizing and Excel was
> failing to repaint, so I tossed the two ScreeUpdating statements into the
> mix, but they did not help. I also tried "Application.Repaint" between
> them, but VBA complains that it's not supported.
>
> Sorry if this is too lengthy. I'd appreciate any help you could offer
> here.
>
>
> Tom Ewald
> Mass Properties
> General Dynamics Land Systems
> --
> 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