+ Reply to Thread
Results 1 to 2 of 2

Bug in Macro

Hybrid View

  1. #1
    Registered User
    Join Date
    01-24-2016
    Location
    Eastbourne
    MS-Off Ver
    Windows 7 64bit
    Posts
    1

    Bug in Macro

    Hi All

    Need assistance with a macro I have created.

    I am trying to insert data from a web source based on a start date and an end date of my choice.

    To fully automate this I want the VB to pick up the dates from 2 cells and use them to get the data from a web page.

    For work security I have replaced the web address with ??.

    Whenever I run the macro is comes up with a bug on the line below that I noted in red.

    HELP PLS!!!



    Sub Macro1()
    '
    ' Macro1 Macro
    '
    
    '
        With ActiveSheet.QueryTables.Add(Connection:= _
            "URL;http://info.??.??.??/performanceEMR/performanceEMR.aspx?StartDate=" & Sheet12.Range("T14") & "%0000:00:00&EndDate=" & Sheet12.Range("T15") & "%2023:59:59&Grouping=CallTaker&Columns=TC&EDC=Lewes&MINAP=Yes" _
            , Destination:=Range("$H$1"))
            .Name = "59&Grouping=CallTaker&Columns=TC&EDC=Lewes&MINAP=Yes"
            .FieldNames = False
            .RowNumbers = False
            .FillAdjacentFormulas = False
            .PreserveFormatting = True
            .RefreshOnFileOpen = False
            .BackgroundQuery = True
            .RefreshStyle = xlInsertDeleteCells
            .SavePassword = False
            .SaveData = True
            .AdjustColumnWidth = True
            .RefreshPeriod = 0
            .WebSelectionType = xlSpecifiedTables
            .WebFormatting = xlWebFormattingNone
            .WebTables = """tblPerformance"""
            .WebPreFormattedTextToColumns = True
            .WebConsecutiveDelimitersAsOne = True
            .WebSingleBlockTextImport = False
            .WebDisableDateRecognition = False
            .WebDisableRedirections = False
           .Refresh BackgroundQuery:=False
        End With
    End Sub
    Last edited by JBeaucaire; 01-27-2016 at 04:59 AM. Reason: Added missing CODE tags. Please read and follow the Forum Rules, link above in the menu bar. Thanks.

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,499

    Re: Bug in Macro

    I've had this issue in the past and it turned out I had a protected worksheet causing it to fail.
    Cannot guarantee that's the issue in your case, but it's worth a check.

    BSB

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Define variable in macro than calling that macro inside another macro
    By jakopak in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-21-2015, 10:58 AM
  2. Using a macro on workbook1 to create a button in wb2 and assigning macro "wb2!macro"
    By penfold1992 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-13-2014, 11:39 AM
  3. [SOLVED] Macro to show Which macro didnt work in a nested macro
    By akhileshgs in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-10-2013, 03:21 AM
  4. Perform macro "on open" specific file- store macro in Personal Macro Workbook?
    By thompssc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-17-2012, 12:38 PM
  5. lookup macro, solver macro, realtime macro
    By xelhelp in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-02-2011, 06:14 PM
  6. Cannot find macro error when running a macro from a macro in a diffrent workbook.
    By Acrobatic82 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-05-2010, 09:22 AM
  7. Macro calling another Macro: "The macro 'Personal.xls!FindChar"
    By William Benson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-07-2005, 09:05 AM

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