There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Business Applications
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Business Applications >
Set email reminder base on Excel


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
Zack Barresse's Avatar
Computer Specs
Distinguished Member with 3,302 posts.
 
Join Date: Jul 2004
Location: Oregon, United States
Experience: I'ma learnin'!
04-Feb-2008, 04:36 PM #31
Ah, missed a critical part - appending the previous entries to the string variable when setting. Here is the code (look at the Select Case statements and see how it sets the strMsg variable differently)...
Code:
Option Explicit

Const NL As String = vbNewLine
Const DNL As String = vbNewLine & vbNewLine
Const StrDateFormat As String = "m/d/yyyy"

Sub CheckEmailStatus()
    Dim OL As Object, olMail As Object, objwShell As Object
    Dim ws As Worksheet, c As Range, strMsg As String, strTemp As String, blnCreated As Boolean
    Set ws = ThisWorkbook.Sheets("Sheet1")
'    Set objwShell = CreateObject("wscript.shell")
    On Error Resume Next
    Set OL = GetObject(, "Outlook.Application")
    blnCreated = False
    If OL Is Nothing Then
        Set OL = CreateObject("Outlook.Application")
        blnCreated = True
    End If
'    objwShell.Run ("""\\701-0131\resources$\home\etsang\My Documents\ClickYes\Express ClickYes\ClickYes.exe"" -activate")
    For Each c In ws.Range("AS10", ws.Cells(ws.Rows.Count, "AS").End(xlUp))
        strTemp = strTemp & "Tag #: " & ws.Cells(c.Row, "Q").Text & NL
        strTemp = strTemp & "Description: " & ws.Cells(c.Row, "R").Text & NL
        strTemp = strTemp & "Equipment Type: " & ws.Cells(c.Row, "T").Text & NL
        strTemp = strTemp & "Activity Code: " & ws.Cells(c.Row, "AP").Text & NL
        Select Case c.Value - DateValue("January 30, 2008") ' Date
        Case Is = 3    'next service date matches a day after today
            strMsg = strMsg & strTemp & "Next service date is on " & Format(c.Value, StrDateFormat) & "." & DNL
        Case Is = 2    'next service date matches a day after today
            strMsg = strMsg & strTemp & "Next service date is on " & Format(c.Value, StrDateFormat) & "." & DNL
        Case Is = 1    'next service date matches a day after today
            strMsg = strMsg & strTemp & "Next service date is on " & Format(c.Value, StrDateFormat) & "." & DNL
        Case Is = 0    'next service date matches today
            strMsg = strMsg & strTemp & "Next service date is today!" & DNL
        End Select
        strTemp = ""
    Next c
    If strMsg <> "" Then
        Set olMail = OL.CreateItem(0)
        olMail.To = "erikson.t@gmail.com"
        olMail.Subject = "Preservation Date"
        olMail.Body = strMsg
        ' olMail.Display 'for testing purposes only
        olMail.Send
    End If
'    objwShell.Run ("""\\701-0131\resources$\home\etsang\My Documents\ClickYes\Express ClickYes\ClickYes.exe"" -suspend")
'    ' objwShell.Run ("""\\701-0131\resources$\home\etsang\My Documents\ClickYes\Express ClickYes\ClickYes.exe"" -stop") 'optional to stop the service altogether
    If blnCreated = True Then OL.Quit
End Sub
I think that should get all of your values. Let us know how it works. Sorry it's taken me a bit to get back to you, been super busy here.
__________________
___________
Regards, Zack - MVP - MS Excel 2005-2008 (If you would like comments in any code, please say so.)

OfficeArticles.com :|: Extreme Excel Tutorial :|: Excel Articles by Ken Puls :|: Excel User Group, by Nick Hodge

What is a Microsoft MVP? :|: Live Tech Support? Click here
sonson411's Avatar
Junior Member with 8 posts.
 
Join Date: Oct 2007
Experience: Intermediate
26-Feb-2008, 04:40 PM #32
Just got back from my vacation...
once again, great thanks, firefytr!!!

one little question about this line:
Select Case c.Value - DateValue("January 30, 2008") ' Date

is there a particular command to set "Today" date, instead of inputting the date everytime by myself??
Zack Barresse's Avatar
Computer Specs
Distinguished Member with 3,302 posts.
 
Join Date: Jul 2004
Location: Oregon, United States
Experience: I'ma learnin'!
26-Feb-2008, 05:45 PM #33
Code:
Select Case c.Value - Date
Date is the VBA command for the current System date. If you want the time, use the Time command. If you want the current date *and* time, use Date + Time.
BigDog12345's Avatar
Junior Member with 2 posts.
 
Join Date: Jul 2008
Experience: Beginner
10-Jul-2008, 10:00 AM #34
I tried the sample .xls file and the code and when I click on the script I only get a screen flash. Nothing else happens. I did change the script for my username on where to find the .xls file on my desktop. Any ideas. The code I used was in #12.


Thanks
slurpee55's Avatar
Computer Specs
Distinguished Member with 3,838 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
10-Jul-2008, 10:21 AM #35
Try the code in #31
BigDog12345's Avatar
Junior Member with 2 posts.
 
Join Date: Jul 2008
Experience: Beginner
10-Jul-2008, 01:59 PM #36
I tried it and it did the same thing. Here are the files I'm using.
Attached Files
File Type: zip Mechanic Equipment Schedule Summary1.zip (10.2 KB, 8 views)
slurpee55's Avatar
Computer Specs
Distinguished Member with 3,838 posts.
 
Join Date: Oct 2004
Location: Southwest Iowa....
Experience: Currently stupid...
10-Jul-2008, 02:34 PM #37
BigDog, since this is a rather old thread (and I haven't seen Zack around lately, but there are some other good coders out there - and I am not one), I would suggest you start a new thread - put a link to this one in it, but post the actual code you are using.
__________________
Iowa? I could have sworn this was heaven.
Well, I think I can answer this question most successfully in mime.

My theme song...
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 02:27 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.