Posts by acat

    Couple of macros below are doing what I need, but create an issue - it closes Internet Explorer window under certain conditions, instead of File Explorer.
    Catch is that without "Call CloseWindow(sPrev)" code keeps opening more and more File Explorer windows.


    On Excel worksheet in A3 there's path to file. File names from that path are listed in A6 and down.


    Code relevant to this question in first macro below starts with line "If Target.Column = 1 And Target.Row > 5 Then"
    Code closes existing File Explorer window, then opens a new one, then selects the next file listed in A6 and down in the newly opened File Explorer window.


    Looking for modification of this code for selection of the next file to take place without opening new or closing existent File Explorer window, i.e. select new file in the same File Explorer window.
    ("Call CopyFirstOne" just copies first set of characters from a cell and not relevant to this question)


    I have Excel generate email through a macro. Added a check box on the spreadsheet and trying to make it so that when checked email is sent, if unchecked email displays.
    Getting Run-time error '424': Object required on line - If CheckBox5.Value = True Then - in below bit of code


    Code
    1. If CheckBox5.Value = True Then
    2. olMail.Send
    3. If CheckBox5.Value = False Then
    4. olMail.Display
    5. End If
    6. End If

    Trying to have my email generating macro address it based on which radio button is checked on the excel worksheet.


    Getting "subscript out of range" on this line

    Code
    1. Set ws = ActiveWorkbook.Worksheets.Item("Sheet1")


    in below code


    Code
    1. Sub IfOptionButtonChecked()
    2. Dim ws As Excel.Worksheet
    3. Set ws = ActiveWorkbook.Worksheets.Item("Sheet1")
    4. Dim optBtn1 As Excel.OptionButton
    5. Set optBtn1 = ws.OptionButtons.Item("Option Button 1")
    6. If optBtn1.Value = 1 Then ' it is checked
    7. Debug.Print "Option Button 1 is checked"
    8. End If
    9. End Sub

    My solution above in #2 has '.Value commented out, but I ended up improving that code further to where it does not require H2 to store the date, and ";" gets put in after previous date stamp only when another date record is being added:



    In H2 I have =TODAY() formula. Need for that date to be added to cell in column F & active row. ADDED is the key word - I am going to be calling this macro from another, which sends email and this macro is meant to keep recording every date email is sent for this line item. Code I have so far is below, but getting "Run-time error'424' Object required" on line

    Code
    1. Set Rng = Range("F" & (ActiveCell.Row)).Value


    Code
    1. Sub AddEmDate()
    2. Dim Rng As Range
    3. Dim c As Range
    4. Set Rng = Range("F" & (ActiveCell.Row)).Value
    5. c.Value = c.Value & ";" & Range("H2").Value
    6. End Sub

    On my Excel spreadsheet: web address is in B, username in C, password in D, UN ID in E, PW ID in F, Button ID in G, land page (to go to after logged in) in H. Right click triggers below macro for that particular row. Succeeds in opening address in B, however not seeing log in credentials being put in and gives "Run-time error '5000': Application-defined or object-defined error" on following line:

    Code
    1. Set e = IE.document.getElementById(Range("G" & (ActiveCell.Row)))


    Here's my code - seems close, but no cigar:


    In range A6:A502 need to delete row(s) if that range contains "Thumbs.db"
    Code I have below does the job, but takes a long time to go through each cell in range and triggers other code due to Selection Change, which I don't want happening, so need a better solution