+ Reply to Thread
Results 1 to 1 of 1

Schedule Macro Run + Email

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-12-2014
    Location
    India
    MS-Off Ver
    2010
    Posts
    153

    Schedule Macro Run + Email

    Hi, All

    I am working on a excel - attch, which has a macro helping me pull in the 'local time' ( Column M ) of different countries from an Internet Server.

    I need help in modifying the below code. to schedule the macro run every hour,

    Kindly advise. Looking forward for your expert help.
    Sub excelforum()
    
    Application.ScreenUpdating = False
    Dim TaD As MSXML2.XMLHTTP, cell As Range
    Dim url$, city$, x&
    On Error GoTo earlyexit
    Set TaD = New MSXML2.XMLHTTP
    url = "http://www.thetimenow.com/suggest.php?location="
    
    For Each cell In Range("L3:L" & Cells(Rows.Count, "L").End(xlUp).Row)
    Application.ScreenUpdating = True
    cell.Activate
    DoEvents
    Application.ScreenUpdating = False
    
    city = Replace(LCase(Cells(cell.Row, 12)), " ", "+")
    x = 0
    
    TaD.Open "GET", url & city & "&" & CInt(1000 * Rnd()), False
    TaD.send
    
    If TaD.responseText = "[]" Then cell.Offset(0, 1) = "Couldn't find the time, sorry!": GoTo nxc:
    If Not cell.Offset(0, -1) = vbNullString And Not cell.Offset(0, -1) = "Unknown" Then x = InStr(TaD.responseText, cell.Offset(0, -1))
    If x > 0 Then cell.Offset(0, 1) = Mid(TaD.responseText, InStr(x, TaD.responseText, Chr(34) & "," & Chr(34)) + 3, 5): GoTo nxc
    x = InStr(TaD.responseText, cell.Offset(0, -2)) - 8
    If x > 0 Then cell.Offset(0, 1) = Mid(TaD.responseText, x, 5): GoTo nxc
    cell.Offset(0, 1) = "Couldn't find the time, sorry!"
    
    nxc:
    Next cell
    
    earlyexit:
    Application.ScreenUpdating = True
    
    End Sub
    Attached Files Attached Files
    Last edited by dineshsachidananda; 09-13-2015 at 10:55 PM.

+ 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. Schedule Email Sending through Outlook using Excel Data
    By Jostler18 in forum Outlook Formatting & Functions
    Replies: 5
    Last Post: 01-13-2015, 05:32 PM
  2. Create a schedule to email the workbook at the end of every day
    By Legend Rubber in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-20-2014, 07:43 AM
  3. how to schedule recurring email reminder
    By macnabong in forum Outlook Formatting & Functions
    Replies: 1
    Last Post: 07-20-2014, 11:10 AM
  4. Email Macro - From excel sheet to Outlook email macro
    By juanes in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-30-2013, 01:59 PM
  5. VBA code for Audit schedule email-weekly
    By Hense in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-27-2012, 04:42 AM
  6. Macro - schedule people for training based off their schedule and available training
    By downed_pipper1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-30-2009, 04:59 PM
  7. Replies: 2
    Last Post: 04-13-2005, 01:06 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