Consulting

Results 1 to 3 of 3

Thread: How to Detect If .csv file Is Open in Win 7

  1. #1

    How to Detect If .csv file Is Open in Win 7

    I have a series of workbooks that extract data from four .csv files when they execute. To simplify things I execute a macro that does nothing but open the 4 .csv files before opening the workbooks that extract data from the .csv files. At times I want to verify that the .csv files have been opened before beginning the data extraction. In Windows XP I looked at the Task Bar which displayed a tab for each open file, so all I had to do is glance at the Task Bar tabs to verify that the .csv files were open.

    Now in Windows 7 the Task Bar displays the name of each open workbook file, but unfortunately it chooses not to display the open .csv files. It shows the open workbooks, but not the data files. I suppose I could issue a message after each .csv file is opened, but that seems so unnecessary and clumsy. Is there another place I can look to see if the .csv files are open?

    I thought maybe the Task Manager might show them, but all it shows are these two lines:
    C:\Excel Documents\^ csv File Backups. . . . . . . . . . . . . running
    C:\Excel Documents\ . . . . . . . . . . . . . . . . . . . . . . . . . . . running
    which isn’t exactly what I am looking for since it doesn’t say anything about 4 individual files.

  2. #2
    Hi Cyberdude,

    Can you just use the Windows function to test whether the files are visible (i.e. open) or not, i.e.:

    Sub IsFileOpen()
        Dim strMyCSVFile1 As String
        
        strMyCSVFile1 = "YourFirstCSVFile.csv"
        
        On Error GoTo MacroErrMsg
            If Windows(strMyCSVFile1).Visible Then
                MsgBox strMyCSVFile1 & " is open in this session"
            End If
            
        Exit Sub
    MacroErrMsg:
        MsgBox strMyCSVFile1 & " is not open in this session"
        
    End Sub
    HTH

    Robert

  3. #3
    Hi, Robert! Thanx for the reply.
    Yes, I can use a macro to give me the status, but I was hoping for something that I could glance at like looking at the toolbar on the Taskbar. After all it is showing the names of the .xlsm tasks, why not the .csv tasks??
    Sid

Posting Permissions

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