Mornign All,
I am spending my Saturday morning writing more macro's to streamline reporting processes. I have a macro I created that opens Access runs a query I have in there and then exports that to excel moves it to the report I need and organizes itself. The problem I am have is if I am in the VBE and step into line by line it does fine. If I just run the macro it runs fine but when I use the shortcute keys no matter which ones I assign to it it stops after it opens the workbook I need.
Sub PenData()
Application.DisplayAlerts = False
Dim oApp As Object
Dim LPath As String
LPath = "C:\Reports and Trending\Penetrationdata.mdb"
Set oApp = CreateObject("Access.Application")
oApp.Visible = True
oApp.OpenCurrentDatabase LPath
oApp.DoCmd.RunMacro "SCASG"
oApp.Visible = False
Windows("Fraud Scorecard.xls").Activate
Sheets("ASG Pen").Range("A2:G200").ClearContents
Workbooks.Open Filename:= _
"C:\Reports and Trending\RCSN Data\ASGPen.xls"
This is where it stops if I use the shortcut keys. It opens the file and then thats it. However, if I just use run or stepinto line by line it continues on.
Windows("ASGPen.xls").Activate
Sheets("ASG Query").Activate
ActiveSheet.UsedRange.Copy
Windows("Fraud Scorecard.xls").Activate
Sheets("ASG Pen").Activate
Range("A1").PasteSpecial
Range("A1").Select
Windows("ASGPen.xls").Close
MsgBox "The Penetration data has been updated."
Application.DisplayAlerts = True
End Sub
Bookmarks