Page 4 of 54 FirstFirst ... 2345614 ... LastLast
Results 31 to 40 of 540

Thread: Appendix Thread. App Index Rws() Clms() Majic code line Codings for other Threads, Tables etc) TEST COPY

  1. #31
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,466
    Rep Power
    10
    Data files after final (second) consolidation:


    Using Excel 2007 32 bit
    15
    ABC15
    $ 3.99
    35
    $ 139.65
    02.Apr.2018 GT1 GT2 GT3 GT4 02.Apr.2018 02.Apr.2018 Greg
    19
    ABC19
    $ 55.00
    22
    $ 1,210.00
    02.Apr.2018 GT1 GT2 GT3 GT4 02.Apr.2018 02.Apr.2018 Greg
    23
    ABC23
    $ 7.22
    62
    $ 447.64
    02.Apr.2018 GT1 GT2 GT3 GT4 02.Apr.2018 02.Apr.2018 Greg
    27
    ABC27
    $ 741.99
    101
    $ 74,940.99
    02.Apr.2018 GT1 GT2 GT3 GT4 02.Apr.2018 02.Apr.2018 Greg
    31
    ABC31
    $ 8.51
    12
    $ 102.12
    02.Apr.2018 GT1 GT2 GT3 GT4 02.Apr.2018 02.Apr.2018 Greg
    35
    ABC35
    $ 11.99
    1
    $ 11.99
    02.Apr.2018 GT1 GT2 GT3 GT4 02.Apr.2018 02.Apr.2018 Greg
    39
    ABC39
    $ 12.99
    5
    $ 64.95
    02.Apr.2018 Greg
    Worksheet: Tabelle1



    Using Excel 2007 32 bit
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    N
    O
    11
    37
    ABC37
    $ 55.00
    22
    $ 1,210.00
    02.Apr.2018 RT1 RT2 RT3 RT4
    02. Apr 18
    02.Apr.2018 Raghu
    12
    41
    ABC41
    $ 7.22
    62
    $ 447.64
    02.Apr.2018 RT1 RT2 RT3 RT4
    02. Apr 18
    02.Apr.2018 Raghu
    13
    45
    ABC45
    $ 741.99
    101
    $ 74,940.99
    02.Apr.2018 RT1 RT2 RT3 RT4
    02. Apr 18
    02.Apr.2018 Raghu
    14
    49
    ABC49
    333.45 €
    99
    33,011.55 €
    02.Apr.2018 RT1 RT2 RT3 RT4
    02. Apr 18
    02.Apr.2018 Raghu
    15
    50
    ABC50
    11.99 €
    1
    11.99 €
    02.Apr.2018 Raghu
    16
    Worksheet: Tabelle1



    Using Excel 2007 32 bit
    28
    ABC28
    $ 55.00
    22
    $ 1,210.00
    02.Apr.2018 MT1 MT2 MT3 MT4 02.Apr.2018 02.Apr.2018 Margaret
    32
    ABC32
    $ 7.22
    62
    $ 447.64
    02.Apr.2018 MT1 MT2 MT3 MT4 02.Apr.2018 02.Apr.2018 Margaret
    36
    ABC36
    $ 741.99
    101
    $ 74,940.99
    02.Apr.2018 MT1 MT2 MT3 MT4 02.Apr.2018 02.Apr.2018 Margaret
    40
    ABC40
    $ 8.51
    12
    $ 102.12
    02.Apr.2018 MT1 MT2 MT3 MT4 02.Apr.2018 02.Apr.2018 Margaret
    44
    ABC44
    $ 11.99
    1
    $ 11.99
    02.Apr.2018 Margaret
    48
    ABC48
    3.99 €
    35
    139.65 €
    02.Apr.2018 Margaret
    Worksheet: Tabelle1




    Using Excel 2007 32 bit
    26
    ABC26
    $ 11.99
    1
    $ 11.99
    02.Apr.2018 JT1 JT2 JT3 JT4 02.Apr.2018 02.Apr.2018 John
    30
    ABC30
    $ 12.99
    5
    $ 64.95
    02.Apr.2018 JT1 JT2 JT3 JT4 02.Apr.2018 02.Apr.2018 John
    34
    ABC34
    $ 333.45
    99
    $ 33,011.55
    02.Apr.2018 JT1 JT2 JT3 JT4 02.Apr.2018 02.Apr.2018 John
    38
    ABC38
    $ 13.66
    7
    $ 95.62
    02.Apr.2018 JT1 JT2 JT3 JT4 02.Apr.2018 02.Apr.2018 John
    42
    ABC42
    $ 3.99
    35
    $ 139.65
    02.Apr.2018 John
    Worksheet: Tabelle1
    Seasonal greetings :-)

  2. #32
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,466
    Rep Power
    10
    Code for anwser to this Thread:
    http://www.excelfox.com/forum/showth...e-folder/page2



    Code:
    Option Explicit
    Sub consolidateToo() '   http://www.excelfox.com/forum/showthread.php/2238-Copy-data-from-Unique-files-into-Masterfile-all-the-files-in-the-same-folder?p=10595#post10595
    Rem 1 ThisWorkbook Info
    Dim MWs1 As Worksheet: Set MWs1 = ThisWorkbook.Worksheets.Item(1) 'Worksheets("OriginalData")
    Dim DtaFName As String: Let DtaFName = VBA.Dir(ThisWorkbook.Path & "\" & "*.xlsx") ' Search criteria set to all Files with .xlsx extension in the same Folder as this workbook, Dir returns first file name that fits criteria
    Dim LrMWs1 As Long: Let LrMWs1 = MWs1.Range("A" & MWs1.Rows.Count & "").End(xlUp).Row
    Rem 2 main Loop for all data files
        Do While DtaFName <> "" ' ==========================================
         Workbooks.Open filename:=ThisWorkbook.Path & "\" & DtaFName
        Dim WBDta As Workbook: Set WBDta = ActiveWorkbook
        Dim WBDtaWs1 As Worksheet: Set WBDtaWs1 = WBDta.Worksheets.Item(1) ' use variable to reference the first worksheet ( counting tabs from the left ) of last opened and therefore active( to be seen ) file
        Dim arrIn() As Variant: Let arrIn() = WBDtaWs1.Range("A1").CurrentRegion.Value
        '2a) loop for all data rows, copy data from completed rows to master file, ( add date to inputed data array '_-##)
        Dim Rw As Long ' --------------------------------
            For Rw = 2 To UBound(arrIn(), 1) ' loop through "rows" in data array
                If arrIn(Rw, 11) <> Empty And arrIn(Rw, 12) = Empty Then ' Condition for completed work not yet consolidated
                 Dim arrCsDte(1 To 1, 1 To 7) As String: Let arrCsDte(1, 1) = arrIn(Rw, 7): arrCsDte(1, 2) = arrIn(Rw, 8): arrCsDte(1, 3) = arrIn(Rw, 9): arrCsDte(1, 4) = arrIn(Rw, 10): arrCsDte(1, 5) = arrIn(Rw, 11): arrCsDte(1, 6) = Format(Date, "dd.mmm.yyyy"): arrCsDte(1, 7) = arrIn(Rw, 13) ' 7 "columns" of data to be added to master file
                 MWs1.Range("A2:A" & LrMWs1 & "").Find(what:=arrIn(Rw, 1), After:=MWs1.Range("A2"), LookIn:=xlValues, Lookat:=xlWhole, searchorder:=xlByRows, searchdirection:=xlNext).Offset(0, 6).Resize(1, 7) = arrCsDte() ' We look down the first column in the master file to find the cell comtaining the   S No   We apply the offest property to thast cell to get across to column G and then the resize property gives us the range of 7 columns to which we may apply the values in the array filled for the row data
                 Let arrIn(Rw, 12) = arrCsDte(1, 6) '(Put the current date in the array made from data range        '_-##)
                Else ' Datá row is completed and consolidated , so nothing to do for this row
                End If
            Next Rw ' End loop for all data rows --------
        '2b) Update and close current data workbook
         Let WBDtaWs1.Range("A1").Resize(UBound(arrIn(), 1), UBound(arrIn(), 2)).Value = arrIn() ' reassign the values from the input data array back to the range as this now has the consolidated date in it
         WBDta.Close savechanges:=True
        '2c Serch for next data file name
         Let DtaFName = VBA.Dir() ' Unqualified Dir returns next found file with previos search criteria, but only returns each file name once
        Loop ' Do While DtaFName <> "" again ==============================
    End Sub
    Seasonal greetings :-)

  3. #33
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,466
    Rep Power
    10

    Checked Library Infomation Excel 2003 Excel 2007 Excel 2010

    Some sample data for other Posts and Threads:
    http://www.eileenslounge.com/viewtopic.php?f=30&t=29652
    Using this code:
    Code:
     Sub Its() ' snb 2017
    Dim It As Variant
      For Each It In ThisWorkbook.VBProject.References
      Dim strIts As String
       Let strIts = strIts & "Description:" & vbTab & It.Description & vbCr & "Name:" & vbTab & vbTab & It.Name & vbCr & "Buitin:" & vbTab & vbTab & It.BuiltIn & vbCr & "Minor:" & vbTab & vbTab & It.minor & vbCr & "Major:" & vbTab & vbTab & It.major & vbCr & "FullPath:" & vbTab & vbTab & It.fullpath & vbCr & "GUID:" & vbTab & vbTab & It.GUID & vbCr & "Type:" & vbTab & vbTab & It.Type & vbCr & "Isbroken:" & vbTab & vbTab & It.isbroken & vbCr & vbCr
      Next It
    Debug.Print strIts ' From  VB Editor Ctrl+g  to get Immediate Window from which info can be copied
    End Sub
    Here some results. ( If anyone passing has other Excel versions and would like to pass on what the code above gives, then that would be nice, thanks )

    Excel 2007
    Code:
    Description:    Visual Basic For Applications
    Name:       VBA
    Buitin:     Wahr
    Minor:      0
    Major:      4
    FullPath:       C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6.DLL
    GUID:       {000204EF-0000-0000-C000-000000000046}
    Type:       0
    Isbroken:       Falsch
    
    Description:    Microsoft Excel 12.0 Object Library
    Name:       Excel
    Buitin:     Wahr
    Minor:      6
    Major:      1
    FullPath:       C:\Program Files\Microsoft Office\Office12\EXCEL.EXE
    GUID:       {00020813-0000-0000-C000-000000000046}
    Type:       0
    Isbroken:       Falsch
    
    Description:    OLE Automation
    Name:       stdole
    Buitin:     Falsch
    Minor:      0
    Major:      2
    FullPath:       C:\Windows\system32\stdole2.tlb
    GUID:       {00020430-0000-0000-C000-000000000046}
    Type:       0
    Isbroken:       Falsch
    
    Description:    Microsoft Office 12.0 Object Library
    Name:       Office
    Buitin:     Falsch
    Minor:      4
    Major:      2
    FullPath:       C:\Program Files\Common Files\Microsoft Shared\OFFICE12\MSO.DLL
    GUID:       {2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}
    Type:       0
    Isbroken:       Falsch
    
    Description:    Microsoft Word 12.0 Object Library
    Name:       Word
    Buitin:     Falsch
    Minor:      4
    Major:      8
    FullPath:       C:\Program Files\Microsoft Office\Office12\MSWORD.OLB
    GUID:       {00020905-0000-0000-C000-000000000046}
    Type:       0
    Isbroken:       Falsch

    Excel 2003
    Code:
    Description:    Visual Basic For Applications
    Name:       VBA
    Buitin:     Wahr
    Minor:      0
    Major:      4
    FullPath:       C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6.DLL
    GUID:       {000204EF-0000-0000-C000-000000000046}
    Type:       0
    Isbroken:       Falsch
    
    Description:    Microsoft Excel 11.0 Object Library
    Name:       Excel
    Buitin:     Wahr
    Minor:      5
    Major:      1
    FullPath:       C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE
    GUID:       {00020813-0000-0000-C000-000000000046}
    Type:       0
    Isbroken:       Falsch
    
    Description:    OLE Automation
    Name:       stdole
    Buitin:     Falsch
    Minor:      0
    Major:      2
    FullPath:       C:\Windows\system32\stdole2.tlb
    GUID:       {00020430-0000-0000-C000-000000000046}
    Type:       0
    Isbroken:       Falsch
    
    Description:    Microsoft Office 11.0 Object Library
    Name:       Office
    Buitin:     Falsch
    Minor:      3
    Major:      2
    FullPath:       C:\Program Files\Common Files\Microsoft Shared\OFFICE11\MSO.DLL
    GUID:       {2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}
    Type:       0
    Isbroken:       Falsch
    
    Description:    Microsoft Word 12.0 Object Library
    Name:       Word
    Buitin:     Falsch
    Minor:      4
    Major:      8
    FullPath:       C:\Program Files\Microsoft Office\Office12\MSWORD.OLB
    GUID:       {00020905-0000-0000-C000-000000000046}
    Type:       0
    Isbroken:       Falsch
    Excel 2010
    Code:
    Description:    Visual Basic For Applications
    Name:       VBA
    Buitin:     Wahr
    Minor:      1
    Major:      4
    FullPath:       C:\PROGRA~2\COMMON~1\MICROS~1\VBA\VBA7\VBE7.DLL
    GUID:       {000204EF-0000-0000-C000-000000000046}
    Type:       0
    Isbroken:       Falsch
     
    Description:    Microsoft Excel 14.0 Object Library
    Name:       Excel
    Buitin:     Wahr
    Minor:      7
    Major:      1
    FullPath:       C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.EXE
    GUID:       {00020813-0000-0000-C000-000000000046}
    Type:       0
    Isbroken:       Falsch
     
    Description:    OLE Automation
    Name:       stdole
    Buitin:     Falsch
    Minor:      0
    Major:      2
    FullPath:       C:\Windows\SysWOW64\stdole2.tlb
    GUID:       {00020430-0000-0000-C000-000000000046}
    Type:       0
    Isbroken:       Falsch
     
    Description:    Microsoft Office 14.0 Object Library
    Name:       Office
    Buitin:     Falsch
    Minor:      5
    Major:      2
    FullPath:       C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE14\MSO.DLL
    GUID:       {2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}
    Type:       0
    Isbroken:       Falsch
     
    Description:    Microsoft Word 14.0 Object Library
    Name:       Word
    Buitin:     Falsch
    Minor:      5
    Major:      8
    FullPath:       C:\Program Files (x86)\Microsoft Office\Office14\MSWORD.OLB
    GUID:       {00020905-0000-0000-C000-000000000046}
    Type:       0
    Isbroken:       Falsch
    Seasonal greetings :-)

  4. #34
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,466
    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
    Seasonal greetings :-)

  5. #35
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,466
    Rep Power
    10
    Another view of last table

    ( for Thread: http://www.excelfox.com/forum/showth...and-send-email )

    Using Excel 2007 32 bit
    Equipment PM
    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
    1
    JUKI GKG GL GL SCREEN PRINTER A123
    06.04.2018
    13.04.2018
    15.03.2018
    12.04.2018
    N/A
    N/A
    2
    JUKI KE-1070L SMT Placement Machine A124
    11.04.2018
    18.04.2018
    28.03.2018
    25.04.2018
    N/A
    N/A
    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
    59
    Heller 1826 MK5 Reflow Oven A126
    N/A
    N/A
    16.03.2018
    13.04.2018
    N/A
    N/A
    62
    Exit Sign -- N/A -- Exit Lights N/A N/A A127
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    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
    75
    ACE Production KISS-102 Selective Wave Solder A129
    16.04.2018
    23.04.2018
    N/A
    N/A
    N/A
    N/A
    101
    FKN system N100 Nibbler Dispensing A130
    N/A
    N/A
    N/A
    N/A
    04.04.2018
    02.05.2018
    109
    Mycronic MY200sx SMT Machine A131
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    112
    X-TEK XTV-160 X-Ray System A132
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    113
    MIRTEC MV-6 OMNI AOI A133
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    116
    JUKI KE-2060RL SMT Placement Machine A134
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    127
    ELGI EG22-150 Air Compressor A135
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    128
    Juki KE-2050 SMT A136
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    137
    Juki K3 Screen printer A137
    06.04.2018
    13.04.2018
    N/A
    N/A
    N/A
    N/A
    141
    Heller 1826 MK5 Reflow Oven A138
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    142
    NISSAN MCU-112A331.V Forklift A139
    N/A
    N/A
    N/A
    N/A
    15.02.2018
    15.03.2018
    142
    NISSAN/yearly oil change and lube MCU-112A331.V Forklift A140
    N/A
    N/A
    N/A
    N/A
    N/A
    N/A
    28.01.1900
    Worksheet: Equipment PM
    Seasonal greetings :-)

  6. #36
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,466
    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
    Seasonal greetings :-)

  7. #37
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,466
    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


    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=UgwplzlpYpmRqjGZem14AaABAg. 9hrvbYRwXvg9ht4b7z00X0
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=UgyOGlCElBSbfPIzerF4AaABAg. 9hrehNPPnBu9ht4us7TtPr
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=UgwHjKXf3ELkU4u4j254AaABAg. 9hr503K8PDg9ht5mfLcgpR
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugw1-OyZiDDxCHM2Rmp4AaABAg.9hqzs_MlQu-9ht5xNvQueN
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz0Uy2bCSCTb1W-0_14AaABAg
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz0Uy2bCSCTb1W-0_14AaABAg.9htChVuaX9W9htG01cKBzX
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugw6UrV69zpeKvLOeOV4AaABAg. 9ht16tzryC49htJ6TpIOXR
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=UgwMKwGZpDjv7vi7pCx4AaABAg
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugw6UrV69zpeKvLOeOV4AaABAg. 9ht16tzryC49htOKs4jh3M
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=UgxVW-am20rQ5GFuJ9F4AaABAg
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugygb0YiLOI7fG1zQSx4AaABAg
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugygb0YiLOI7fG1zQSx4AaABAg. 9htWqRrSIfP9i-fyT84gqd
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugygb0YiLOI7fG1zQSx4AaABAg. 9htWqRrSIfP9i-kIDl-3C9
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz0Uy2bCSCTb1W-0_14AaABAg.9htChVuaX9W9i57J9GEOUB
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz0Uy2bCSCTb1W-0_14AaABAg.9htChVuaX9W9i58MGeM8Lg
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz0Uy2bCSCTb1W-0_14AaABAg.9htChVuaX9W9i59prk5atY
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=UgwaWs6XDXdQybNb8tZ4AaABAg. 9i5yTldIQBn9i7NB1gjyBk
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=UgxV9eNHvztLfFBGsvZ4AaABAg. 9i5jEuidRs99i7NUtNNy1v
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugx2zSXUtmLBSDoNWph4AaABAg. 9i3IA0y4fqp9i7NySrZamd
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg. 9hwsCHaKX6A9i7Qs8kxEqH
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg. 9hwsCHaKX6A9i7TqGQYqTz
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg. 9hwsCHaKX6A9iAJSNws8Zz
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg. 9hwsCHaKX6A9iAJvZ6kmlx
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg. 9hwsCHaKX6A9iAK0g1dU7i
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg. 9hwsCHaKX6A9iAKCDqNmnF
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg. 9hwsCHaKX6A9iAKHVSTGHy
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg. 9hwsCHaKX6A9iAKSBKPcJ6
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg. 9hwsCHaKX6A9iAKgL6lrcT
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg. 9hwsCHaKX6A9iAKlts8hKZ
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg. 9hwsCHaKX6A9iAKrX7UPP0
    https://www.youtube.com/watch?v=LuAipOW8BNQ&lc=Ugz4oMZ09MKcExYlWf94AaABAg. 9hwsCHaKX6A9iAL5MSjWpA
    Seasonal greetings :-)

  8. #38
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,466
    Rep Power
    10

    Re Post code with Code tags

    To support this Thread
    http://www.excelfox.com/forum/showth...0679#post10679

    Re post code in Code tags, Like ....

    Please use CODE TAGS if you are writing codes in your post.

    To use code tags,
    either
    select your entire code and press the code tag button # in the editor below,
    or
    simply type your code as below

    [Code]Your Code Here[/Code]

    [Code]
    Your Code Here
    [/Code]




    [Code]
    Private Sub cmdNot_Click()

    Dim OutApp As Object
    Dim OutMail As Object

    …………………….

    ……………..

    End Sub
    [/Code]




    BBCodeCodeTags.JPG : https://imgur.com/4HunNcs
    Attachment 2060

    _.__________________

    If you post using Code tags, then it will come out in the final post in a Code Window, like this:
    Code:
    Private Sub cmdNot_Click()
    Dim OutApp As Object
    Dim OutMail As Object
    Dim fileName As String
    Dim mSubject As String
    Dim signature As String
    Dim fname As String
    Dim mBody As String
    Dim rng As Range
    Dim rng1 As Range
    Dim ws As Worksheet
    Dim mailTo As String
     Set ws = Sheets("MRO")
     fname = ws.Range("B4")
     mSubject = "MRO " & " For " & Range("C6").Value
     Set OutApp = CreateObject("Outlook.Application")
     Set OutMail = OutApp.CreateItem(0)
    'mBody = "2-SO\Material Request Form .xlsm"
    
    Dim Path As String
    
     mBody = "<font size=""3"" face=""Calibri"">" & _
    "Dear Team,<br><br>" & _
    "Please open the file from below link and put your signature on the respective cell after you completed your task.<br><B>" & _
    fileName & ".xlsm" & "</B> is created.<br>" & _
    "Click on this link to open the file : " & _
    "<A HREF=""file://" & Path & fileName & ".xlsm" & _
    """>Files are saved here</A>" & "-->" & Range("C6").Value & _
    "<br><br>Best Regards," & _
    "<br><br></font>"
    
        With OutMail
         .display
        End With
     signature = OutMail.body
        With Application
         .EnableEvents = False
         .ScreenUpdating = False
        End With
    
        With OutMail
         '.To = "email"
         .To = ""
         .CC = ""
         .BCC = ""
         .Subject = mSubject
         '.body = "Dear Team," & vbCrLf & vbCrLf & "Please open the file from below link and put your signature on the respective cell and save the sheet"
         '.htmlbody = RangetoHTML(rng)
         .htmlbody = mBody
         '.Attachments.Add fileName
         .display
        End With
     'ws.PageSetup.RightHeader = "&""Calibri,italic""&11& " & ws.Range("A1")
     ActiveWorkbook.Close False
     ActiveWorkbook.Close
     On Error GoTo 0
    
     Set OutMail = Nothing
     Set OutApp = Nothing
    
        With Application
         .ScreenUpdating = True
         .EnableEvents = True
        End With
    Attached Images Attached Images
    Seasonal greetings :-)

  9. #39
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,466
    Rep Power
    10
    Code in code tags from here:
    http://www.excelfox.com/forum/showth...0699#post10699

    Code:
    Dim OutApp As Object
    Dim OutMail As Object
    Dim fileName As String
    Dim mSubject As String
    Dim signature As String
    Dim fname As String
    Dim mBody As String
    Dim rng As Range
    Dim rng1 As Range
    Dim ws As Worksheet
    Dim mailTo As String
     fname = ws.Range("A1")
     mSubject = "Equipment" & " For " & Range("A1").Value
     Set OutApp = CreateObject("Outlook.Application")
     Set OutMail = OutApp.CreateItem(0)
     'mBody = "Z:\2\Form\\Manufacturing Order.xlsm"
    
    Dim Path As String
     ws.Protect ("Equipment")
     Path = "\\Equipment- Maint RecordsThai1.xlsm"
     mBody = "<font size=""3"" face=""Calibri"">" & _
       "Dear Team,<br><br>" & _
       "Please open the file from below link and change the date on the respective cell after you completed your task.<br><B>" & _
       fileName & ".xlsm" & "</B> is created.<br>" & _
       "Click on this link to open the file : " & _
       "<A HREF=""file://" & Path & fileName & ".xlsm" & _
       """>Files are saved here</A>" & "-->" & Range("A1").Value & _
       "<br><br>Best Regards," & _
       "<br><br></font>"
    
        With OutMail
         .display
        End With
     signature = OutMail.body
        With Application
         .EnableEvents = False
         .ScreenUpdating = False
        End With





    Code:
    Private Sub cmdNot_Click()
        If Application.UserName = "Thai Nguyen" Then
        Dim ws As Worksheet: Set ws = Sheets("Name")
        Dim rng As Range, rng1 As Range
        Dim fileName As String, fname As String
         Let fname = ws.Range("B4")
         Let mSubject = "Name"
        Dim OutApp As Object, OutMail As Object
         Set OutApp = CreateObject("Outlook.Application")
         Set OutMail = OutApp.CreateItem(0)
        Dim Subject As String, signature As String, mBody As String, mailTo As String
            'mBody = "copy you link path in here"
         Let mBody = "<font size=""3"" face=""Calibri"">" & _
         "Hi Team,<br><br>" & _
         "Please open the file from below link and put your signature on the respective cell after you completed your task.<br><B>" & _
         ActiveWorkbook.Name & "</B> is created.<br>" & _
         "Click on this link to open the file : " & _
         "<A HREF=""file://" & ActiveWorkbook.FullName & """>Link to the file</A>" & _
         "<br><br>Regards," & _
         "<br><br>Thai Nguyen</font>    "
         OutMail.display
         Let signature = OutMail.body
            With Application
             .EnableEvents = False
             .ScreenUpdating = False
            End With
            With OutMail
            '.To = "email"
                If ws.Range("EU16") = True Then
                 Let mailTo = mailTo + "Thai Nguyen;"
                Else
                End If
                If ws.Range("EU17") = True Then
                mailTo = mailTo + "email"
                End If
                If ws.Range("EU18") = True Then
                 Let mailTo = mailTo + "email"
                End If
                If ws.Range("EU19") = True Then
                 Let mailTo = mailTo + "email"
                End If
             .To = mailTo
             .CC = "Thai Nguyen"
             .BCC = ""
             .Subject = mSubject
             '.body = "Hi Team," & vbCrLf & vbCrLf & "Please open the file from below link and put your signature on the respective cell and save the sheet"
             '.htmlbody = RangetoHTML(rng)
             .htmlbody = mBody
             '.Attachments.Add fileName
             .display
            End With
         'ws.PageSetup.RightHeader = "&""Calibri,italic""&11& " & ws.Range("A1")
         ws.Protect ("Name")
         ActiveWorkbook.Save
         ActiveWorkbook.Close
         On Error GoTo 0
        
        Set OutMail = Nothing
        Set OutApp = Nothing
            With Application
             .ScreenUpdating = True
             .EnableEvents = True
            End With
        Else
         MsgBox "You are not authorised to send BOM form, please check with BOM owner"
        End If
    End Sub
    Seasonal greetings :-)

  10. #40
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,466
    Rep Power
    10

    Share account for testing file access from a hyperlink in a received EMail

    Share account for testing file access from a hyperlink in a received EMail
    In support of a possible solution to this post in this Thread:
    http://www.excelfox.com/forum/showth...0724#post10724

    It is required to have a simple hyperlink to an Excel File appear in the received Email sent to members of a team.
    I am not sure currently how to get a link directly to the File.

    An second alternative involves storing the file at a File sharing site and using the link to the file as the URL part of a hyperlink.

    This post discusses the setting up of such an account to allow storing of, and sharing via a supplied link to, the file.

    As an example of a file sharing site we consider the free version of box.net
    Some googling my be needed to finally get at the free version which may go under the name of “free” , “Individual rate”, “Personal free”
    Currently you need to find your way to the free 10GB offer. This is currently at this link:
    https://account.box.com/signup/n/personal#fbms6
    Free10GB box net account register.JPG : https://imgur.com/NB3GThi
    Note , by registering, you can choose a language to suit you.
    Free10GB Select language .JPG : : https://imgur.com/aNzW1kq
    ( You can change the language to a different one after registering also
    Free10GB Change language .JPG : https://imgur.com/IosqbAI )


    For this registering , I use the created gmail account used for experiments in the current thread which this post supports, excellearning12@gmail.com ( excelfox Thread : http://www.excelfox.com/forum/showth...and-send-email )

    The password I pass on privately to those needing
    Free10GB box net account register 2.JPG : https://imgur.com/Y2pLogO
    Free10GB box net account register 3.JPG : https://imgur.com/QhCR8fP
    Free10GB box net account register Verify Email 4.JPG : https://imgur.com/ffG7erw

    Various steps are then gone through, they may be slightly different to the following:

    At some point you should you should see the possibility to upload a file, following steps similar to these:
    Free10GB box net 5 .JPG : https://imgur.com/lNWvQwF
    To upload a file and get a URL link to use in a hyperlink to it:
    Upload Files:
    Free10GB box net 6 .JPG : https://imgur.com/rTU1Xbk
    Select a file:
    Free10GB box net 7 .JPG : https://imgur.com/wKKlqoO
    Select share to obtain a URL link to the file :
    Free10GB box net 8 .JPG : https://imgur.com/R3VbyhR
    Copy link to be used in Hyperlink :
    Free10GB box net 9 .JPG : https://imgur.com/8yaYwaK
    Seasonal greetings :-)

Similar Threads

  1. Replies: 185
    Last Post: 05-22-2024, 10:02 PM
  2. Replies: 540
    Last Post: 04-24-2023, 04:23 PM
  3. Replies: 3
    Last Post: 03-07-2022, 05:12 AM

Posting Permissions

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