Results 1 to 8 of 8

Issues with Application.DisplayAlert = False

Threaded View

  1. #1
    Registered User
    Join Date
    10-20-2012
    Location
    Usa
    MS-Off Ver
    Excel 2010
    Posts
    3

    Issues with Application.DisplayAlert = False

    Hi Community;

    First of all I want to introduce myself, my name is Euro and I'm a Macro programmer beginner, having said that I want to thank all the forum community for the amazing amount of information that it is available here, even if this is my first post I ve been browsing the forums for knowledge for some days now.

    Having said that, let s go to the point. This is the first Macro that I'm writing, and what it does is basically downloads data from the internet and arranges it in the appropiate format to create a Pivot Table from the database. I'm pretty satisfied with its performance, but I want to remove the annoying alert when it closes the workbook "Do you Want to save?" etc. In order to not have to be clicking the alerts while it downloads. However, when I add the Application.DisplayAlert = False into my code, the macro fails to copy the information to the database spreadsheet. The error is "1004 Microsoft Excel Cannot paste the data" (On the Underlined + Bold Statement below).
    My Code :

    Sub DataHooper()
        Application.DisplayAlerts = False
        Worksheets("DataBase").Select
        Range("A2").Select
        Do While ActiveCell.Value <> Empty
        ActiveCell.Offset(1, 0).Select
        Loop
        Worksheets("Input Table").Select
        Range("B6").Select
        Do While ActiveCell.Value <> Empty
        ActiveCell.Offset(0, 8).Select
        MyLink = ActiveCell
        Workbooks.Open Filename:=MyLink
        Windows("table.csv").Visible = True
        Columns("B:E").Select
        Selection.Delete Shift:=xlToLeft
        Range("B2").Select
        Range(Selection, Selection.End(xlDown)).Select
        Selection.ClearContents
        Range("A2:C2").Select
        Range(Selection, Selection.End(xlDown)).Select
        Selection.Copy
        ActiveWindow.Close
        Worksheets("DataBase").Select
        ActiveCell.Select
        ActiveSheet.Paste  
        Worksheets("Input Table").Select
        ActiveCell.Offset(0, -8).Select
        Selection.Copy
        Worksheets("Database").Select
        ActiveCell.Select
        Dim NumberRows As Integer
        Range(Selection, Selection.End(xlDown)).Select
        NumberRows = Selection.Rows.Count
        ActiveCell.Offset(0, 1).Select
        ActiveCell.Resize(NumberRows, 1).Select
        ActiveSheet.Paste
        ActiveCell.Offset(0, -1).Select
        Selection.End(xlDown).Select
        ActiveCell.Offset(1, 0).Select
        Worksheets("Input Table").Select
        ActiveCell.Offset(1, 0).Select
        Loop
        Application.CutCopyMode = False
        Application.DisplayAlerts = True
    End Sub
    Last edited by jeffreybrown; 10-25-2012 at 11:51 AM. Reason: Please use code tags...Thanks.

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