Results 1 to 10 of 380

Thread: Appendix Thread. ( Codes for other Threads, etc.) Event Coding Drpdown Data validation

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10

    Test data supplied by Thainguyen

    To support solution to this Thread:
    http://www.excelfox.com/forum/showth...and-send-email


    Test data supplied by Thainguyen for this Thread :
    http://www.excelfox.com/forum/showth...and-send-email



    Code:
    Using Excel 2007 32 bit
    
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    N
    1
    Equipment PM
    2
    Machine EQ.ID
    Manufacture
    Model
    Description
    Serial Number
    Weekly Date of Service
    Weekly Next Service
    Monthly Date of Service
    Monthly Next Service
    Quarterly Date of Service
    Quarterly Next Service
    Softwear
    3
    4
    1
    JUKI GKG GL GL SCREEN PRINTER A123
    06.04.2018
    13.04.2018
    15.03.2018
    12.04.2018
    N/A
    N/A
    5
    2
    JUKI KE-1070L SMT Placement Machine A124
    11.04.2018
    18.04.2018
    28.03.2018
    25.04.2018
    N/A
    N/A
    6
    9
    ACE Production KISS-101B Selective Wave Solder A125
    06.04.2018
    13.04.2018
    15.03.2018
    12.04.2018
    N/A
    N/A
    7
    59
    Heller 1826 MK5 Reflow Oven A126
    N/A
    N/A
    16.03.2018
    13.04.2018
    N/A
    N/A
    8
    62
    Exit Sign -- N/A -- Exit Lights N/A N/A A127
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    9
    69
    South-Tek System N2-Gen 35ST Nitrogen Generator A128
    10.04.2018
    17.04.2018
    N/A
    N/A
    09.03.2018
    06.04.2018
    10
    75
    ACE Production KISS-102 Selective Wave Solder A129
    16.04.2018
    23.04.2018
    N/A
    N/A
    N/A
    N/A
    11
    101
    FKN system N100 Nibbler Dispensing A130
    N/A
    N/A
    N/A
    N/A
    04.04.2018
    02.05.2018
    12
    109
    Mycronic MY200sx SMT Machine A131
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    13
    112
    X-TEK XTV-160 X-Ray System A132
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    14
    113
    MIRTEC MV-6 OMNI AOI A133
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    15
    116
    JUKI KE-2060RL SMT Placement Machine A134
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    16
    127
    ELGI EG22-150 Air Compressor A135
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    17
    128
    Juki KE-2050 SMT A136
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    18
    137
    Juki K3 Screen printer A137
    06.04.2018
    13.04.2018
    N/A
    N/A
    N/A
    N/A
    19
    141
    Heller 1826 MK5 Reflow Oven A138
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    20
    142
    NISSAN MCU-112A331.V Forklift A139
    N/A
    N/A
    N/A
    N/A
    15.02.2018
    15.03.2018
    21
    142
    NISSAN/yearly oil change and lube MCU-112A331.V Forklift A140
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    22
    28.01.1900
    23
    Worksheet: Equipment PM
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    KILL A MODERATOR!!

  2. #2
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    Table from above again
    Using Excel 2007 32 bit
    Row\Col
    F
    G
    H
    I
    J
    K
    1
    2
    Weekly
    Date of Service
    Weekly
    Next Service
    Monthly
    Date of Service
    Monthly
    Next Service
    Quarterly
    Date of Service
    Quarterly
    Next Service
    3
    4
    06.04.2018
    13.04.2018
    15.03.2018
    12.04.2018
    N/A
    N/A
    5
    11.04.2018
    18.04.2018
    28.03.2018
    25.04.2018
    N/A
    N/A
    6
    06.04.2018
    13.04.2018
    15.03.2018
    12.04.2018
    N/A
    N/A
    7
    N/A
    N/A
    16.03.2018
    13.04.2018
    N/A
    N/A
    8
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    9
    10.04.2018
    17.04.2018
    N/A
    N/A
    09.03.2018
    06.04.2018
    10
    16.04.2018
    23.04.2018
    N/A
    N/A
    N/A
    N/A
    11
    N/A
    N/A
    N/A
    N/A
    04.04.2018
    02.05.2018
    12
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    13
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    14
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    15
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    16
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    17
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    18
    06.04.2018
    13.04.2018
    N/A
    N/A
    N/A
    N/A
    19
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    20
    N/A
    N/A
    N/A
    N/A
    15.02.2018
    15.03.2018
    21
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    22
    28.01.1900
    Worksheet: Equipment PM
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    KILL A MODERATOR!!

  3. #3
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    Code for this Thread:
    http://www.excelfox.com/forum/showth...and-send-email

    Code:
    Option Explicit
    Private Sub Workbook_Open()
    Rem 1 Worksheets Info.
    Dim Ws As Worksheet: Set Ws = ThisWorkbook.Worksheets("Equipment PM")
    Dim Lr As Long: Let Lr = Ws.Range("A" & Ws.Rows.Count & "").End(xlUp).Row
    Rem 2 data range
    Dim arrIn() As Variant: Let arrIn() = Ws.Range("A1:K" & Lr & "").Value2
    Rem 3 Todays date as Double(Long) number
    Dim TdyDbl As Long: Let TdyDbl = CLng(Now()) ' like 43233 for 13 May 2018
     Let TdyDbl = CLng(DateSerial(2018, 3, 15)) - 3 ' To test only #####
    Rem 4 Rows for due date for next service for weekly(G), Monthly(I), and Quarterly(K). Code to pick up the date from these columns and automatic send email notification 3 days before the due date.
    '4a) determine rows as string or those row numbers
    Dim Rw As Long
        For Rw = 4 To Lr Step 1
            If arrIn(Rw, 7) = TdyDbl + 3 Or arrIn(Rw, 9) = TdyDbl + 3 Or arrIn(Rw, 11) = TdyDbl + 3 Then
        Dim strRws As String 'String of rows for criteria met in  G   Or  I  Or  K
         Let strRws = strRws & " " & Rw
            Else ' No "3 days before due service date" criteria met for this row
            End If
        Next Rw
        If strRws = "" Then Exit Sub ' case no criteria met for the day this workbook was opened.
     Let strRws = VBA.Strings.Mid$(strRws, 2) ' take off first space
    '4b) Array of rows
    Dim arrRws() As String: Let arrRws() = VBA.Strings.Split(strRws, " ", -1, vbBinaryCompare)
    Rem 5 HTML Table of required output '
    Dim ProTble As String
    '5a) Table start
    Let ProTble = _
    "<table width=520>" & vbCrLf & _
    "<col width=30>" & vbCrLf & _
    "<col width=150>" & vbCrLf & _
    "<col width=150>" & vbCrLf & _
    "<col width=150>" & vbCrLf & _
    "<col width=40>" & vbCrLf & vbCrLf
    '5b) data rows
    Dim iCnt As Long, jCntStear As Variant, jCnt As Long ' data "columns" ,     "rows"
        For Each jCntStear In arrRws() ' To Loop for all rows meeting criteria
         Let jCnt = jCnt + 1  ' Rows count for table to send
        Dim LisRoe As String
         Let LisRoe = LisRoe & "<tr height=16>" & vbCrLf
            For iCnt = 1 To 5
             Let LisRoe = LisRoe & "<td>" & arrIn(arrRws(jCnt - 1), iCnt) & "</td>" & vbCrLf ' -1 is because Split Function returns array of string types in 1 Dimensional array starting at indice 0, so our jCnt is one too big
            Next iCnt
         Let LisRoe = LisRoe & "</tr>" & vbCrLf & vbCrLf
         Let ProTble = ProTble & LisRoe
         Let LisRoe = ""
        Next jCntStear
     Let ProTble = ProTble & "</table>" ' table end
     Debug.Print ProTble
    Rem 6 EMail send 'For info see:  http://www.excelfox.com/forum/showth...once#post10519
    'Working at my end With my With End With Created LCDCW Library, (LCD 1.0 Library ) (Linking Configuration Data_Cods Wollups)
        With CreateObject("CDO.Message") ' -Linking Cods Wollups--------
        Dim LCD_CW As String: Let LCD_CW = "http://schemas.microsoft.com/cdo/configuration/"
         .Configuration(LCD_CW & "smtpusessl") = True '
         .Configuration(LCD_CW & "smtpauthenticate") = 1  '
        '  ' Sever info
         .Configuration(LCD_CW & "smtpserver") = "smtp.gmail.com" ' "securesmtp.t-online.de" "smtp.mail.yahoo.com" "smtp.live.com" "pod51017.outlook.com"  "smtp-mail.outlook.com" "smtp.live.com"  "securesmtp.t-online.de"
        '  The mechanism to use to send messages.
         .Configuration(LCD_CW & "sendusing") = 2  '  Based on the LCD_OLE Data Base of type DBTYPE_I4
         .Configuration(LCD_CW & "smtpserverport") = 25 ' 465 or 25 for t-online.de 'or 587 'or 25
        '
    
         .Configuration(LCD_CW & "sendusername") = "YourEMailAddress"
         .Configuration(LCD_CW & "sendpassword") = "YourEMailPassword"
        ' Optional - How long to try
         .Configuration(LCD_CW & "smtpconnectiontimeout") = 30 '
        ' Intraction protocol is Set/ Updated
         .Configuration.Fields.Update '
        'End With ' ----------------------      my Created  LCDCW Library
        'With ' --- ' Data to be sent------     my Created  LCDCW Library
         Dim strHTML As String: Let strHTML = ProTble 'ProTble(rngArr()) ' Let strHTML = RangetoHTML(rng)
        '         Dim Highway1 As Long: Let Highway1 = FreeFile(0) '
        '          Open ThisWorkbook.Path & "" & "jawaharse.txt" For Output As #Highway1 '
        '          Print #Highway1, strHTML
        '          Close #Highway1
        .To = "Doc.AElstein@t-online.de" '
        .cc = ""
        .BCC = ""
        .from = """Equipment- Maint Records.xlsm"" <YourEMailAddresseOrAnyCrap>"
        .Subject = Ws.Range("A1").Value
        .HTMLBody = strHTML
        '        .AddAttachment ThisWorkbook.Path & "\jawaharse.txt"
        .Send ' Do it
        End With ' CreateObject("CDO.Message") -----my Created  LCDCW Library
    End Sub
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    KILL A MODERATOR!!

Similar Threads

  1. Replies: 192
    Last Post: 08-30-2025, 01:34 AM
  2. Replies: 293
    Last Post: 09-24-2020, 01:53 AM
  3. Appendix Thread. Diet Protokol Coding Adaptions
    By DocAElstein in forum Test Area
    Replies: 6
    Last Post: 09-05-2019, 10:45 AM
  4. Restrict data within the Cell (Data Validation)
    By dritan0478 in forum Excel Help
    Replies: 1
    Last Post: 07-27-2017, 09:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •