Results 1 to 5 of 5

Excel Macro does not complete with shortcut key.

Threaded View

  1. #1
    Forum Contributor
    Join Date
    05-19-2010
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2003
    Posts
    107

    Excel Macro does not complete with shortcut key.

    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
    Last edited by CJPHX; 06-28-2010 at 09:35 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1