Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 11th, 2014, 12:31 PM
Registered User
 
Join Date: Nov 2014
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Please Help! Comparing date and generating hyperlink

hi,

im new to excel VBA and coding all together, i wrote a simple function to read dates from a spreadsheet, compare the date with today and generate an email and send if it matches.

it starts at cell R5, compares to today's date and supposed to move down to the next, i.e.. R6 and keep going. but i cant get it to go further than R5
heres what i got so far:

Code:
Function mailer()
'Application.OnTime timevalue("09:00:00"), "mailer"


Dim i As Long
Dim d As Date
Dim n As Range
Dim r As Range
Dim proj As String
Dim body As String
Dim email As String
Dim url As String
Dim subj As String

Set r = Cells(5, 18)
Set n = Range("d5")
d = Date

email = "[email protected]"

For i = 5 To 2000
    With r = Cells(i, 18)
        With n = Cells(i, 5)

            Select Case (r.Value)
            Case Is <> d
            subj = n.Value
            body = "Project " & n.Value & " completed on the " & r.Value
            url = "mailto:" & email & "?" & "&subject=" & subj & "&" & "body=" & body
            
            MsgBox url
            ActiveWorkbook.FollowHyperlink (url)
            End Select
        End With
    End With
Next i


Application.Wait (Now + timevalue("0:00:05"))
Application.SendKeys "%s"

End Function
 
Old November 14th, 2014, 09:06 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

I believe you are attempting to use a Webmail client / trigger through Web. Can you try using Outlook etc. This will be elegant solution

http://vbadud.blogspot.in/2007/04/vb...-vba-mail.html

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips &amp; Tricks (http://www.vbadud.blogspot.com)





Similar Threads
Thread Thread Starter Forum Replies Last Post
comparing date from access and asp.net sonam b BOOK: Beginning ASP.NET 2.0 and Databases 0 October 29th, 2009 01:36 AM
comparing date column with sql server mallikalapati ASP.NET 2.0 Professional 3 March 12th, 2008 06:06 PM
comparing date/time fields on form validation Lucy Javascript How-To 1 June 20th, 2006 09:22 AM
Trouble with comparing date fields JimmyNeutron Access VBA 3 February 22nd, 2005 09:14 AM
prob with comparing date in access nilesh_parmar Access 1 March 29th, 2004 10:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.