LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default What is the test for whether a file is open?

What's the test for whether a file is currently open (or closed)?

My app writes to a log file, but I don't want to burden the caller
with opening the file in the event he never has to write to it. So I
want:

Dim H As Long

Sub Log(Msg as String)
If Not IsOpen(H) then
Open LogFile For Output As #H
Print #H, FileHeader & DateTime
Print #H,
End If

Print #H, Msg
End Sub

Sub Main
Repeat
If Not Something Then
Log "Oops"
End If
Until SomethingElse
Close #H
End Sub

So what expression should "IsOpen(H)" be?

Thanks.

***
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
test file - is open? karmela Excel Programming 3 November 22nd 07 07:20 AM
VBA Assistance needed to test for open file in a different direct Brent E Excel Programming 4 May 2nd 07 07:19 PM
Open Test file with VBA with a changing file number Michael from Austin Excel Programming 4 October 14th 05 03:18 PM
Open file - How to test the path ? Alex St-Pierre Excel Programming 3 February 7th 05 06:36 PM
Test for Open File Aaron Excel Programming 6 January 6th 05 12:37 PM


All times are GMT +1. The time now is 05:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"