maikusama
08-21-2015, 03:23 PM
Sub rununzipandMove()
Dim wsh As Object
Set wsh = VBA.CreateObject("WScript.Shell")
Dim waitOnReturn As Boolean: waitOnReturn = True
Dim windowStyle As Integer: windowStyle = 1
wsh.Run "cmd.exe /c ""c:\temp\test.bat"", windowStyle, waitOnReturn"
Call importintoAccess
End Sub
Sub importintoAccess()
Dim runAccess As Object
Set runAccess = CreateObject("Access.Application")
Call runAccess.openCurrentDatabase("C:\Temp\CLM.accdb")
runAccess.Visible = True
runAccess.DoCmd.RunMacro "Import"
End Sub
When I run this code, it should run the CMD batch file, then once that has completed make the call to run the Access file. But it's calling the access right away as soon as the batch file opens.. What am I doing wrong?
Dim wsh As Object
Set wsh = VBA.CreateObject("WScript.Shell")
Dim waitOnReturn As Boolean: waitOnReturn = True
Dim windowStyle As Integer: windowStyle = 1
wsh.Run "cmd.exe /c ""c:\temp\test.bat"", windowStyle, waitOnReturn"
Call importintoAccess
End Sub
Sub importintoAccess()
Dim runAccess As Object
Set runAccess = CreateObject("Access.Application")
Call runAccess.openCurrentDatabase("C:\Temp\CLM.accdb")
runAccess.Visible = True
runAccess.DoCmd.RunMacro "Import"
End Sub
When I run this code, it should run the CMD batch file, then once that has completed make the call to run the Access file. But it's calling the access right away as soon as the batch file opens.. What am I doing wrong?