Results 1 to 11 of 11

How to know if a file (notepad) is open?

Threaded View

  1. #1
    Registered User
    Join Date
    11-01-2012
    Location
    helsinki, finland
    MS-Off Ver
    Excel 2007
    Posts
    81

    How to know if a file (notepad) is open?

    Hello!

    How to now if Notepad, let's say test.txt, is open or not?

    Also how to close it or any file.

    Around internet there are a lot of virtual things as close notepad with VBA,
    however, so far I haven't found any working code,
    this looks quite nice:
    Dim fileToOpen As String
      fileToOpen = "C:\test.txt"
      Open fileToOpen For Output As #1
         Sleep 1000
      Close #1
    End Sub
    However, it does not open test.txt so I don't now could it close it also.

    The big question is as the title suggest, how can one know if test.txt is already open?

    regards
    keymuu
    Last edited by keymuu; 12-05-2012 at 05:30 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1