Posts by Logit

    Thanks for the upload and info.


    I tested your workbook just as it is posted. It was able to display the following file types : .xlsx, xlsm, jpg, .pdf & .txt .

    It displayed all of those files without error or crashing.


    I suspect something else is happening on your end with the workbook. Regretfully, there is no way for me to determine what that might be.

    Here is a similar project from which you can utilize the code.

    The following paste in a Routine Module:


    The following paste in ThisWorkbook module :


    Code
    1. Option Explicit
    2. Private Sub Workbook_BeforeClose(Cancel As Boolean)
    3. StopTimer
    4. End Sub
    5. Private Sub Workbook_Open()
    6. StartTimedRefresh
    7. End Sub

    Try this ... can't guarantee anything.


    If you are not opposed to doing so ... use an ActiveX button rather than a Userform Button. Paste this macro

    into the Sheet module :


    Code
    1. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    2. If Range("A1").Value = "ok" Then
    3. Sheets("sh").CommandButton1.Enabled = True
    4. ElseIf Range("A1").Value <> "ok" Then
    5. Sheets("sh").CommandButton1.Enabled = False
    6. End If
    7. End Sub

    .

    Here is a similar macro that can be edited to fit your needs. At present it does not create a new workbook and of course it does not

    search Col A.


    .

    Edit this line to reflect the column you want the data displayed :


    Code
    1. Worksheets(1).Range("B" & I).Value = Worksheets(2).Range("B" & fRow).Value


    Change to :


    Code
    1. Worksheets(1).Range("J" & I).Value = Worksheets(2).Range("B" & fRow).Value

    .

    There was one term missing from my submitted answer. Here is the correction.


    .

    Another method :


    Files