Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2007

Tip: Looking for answers? Try searching our database.

File open?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jille - 05 Feb 2007 01:29 GMT
Hi,

I'm writing a macro that tests to see if an Excel file is currently open.
I've tried the following with no luck:

if Excel.application.workbooks(File).open = true then
...
end if

Any ideas?

Thanks,
Jille
Perry - 05 Feb 2007 01:34 GMT
Utilize below/bottom examplified function as in below immediate window
quest:

? fileisopen("c:\data\ta\ta\ta\myfile.xls")
False

'= VBA function outlay
Function FileIsOpen(ByVal FileName As String) As Boolean
Dim i As Integer
   i = FreeFile
   On Error GoTo ErrOpenFile
   Open FileName For Binary Access Read Lock Read As #i
   Close #i
   FileIsOpen = True
ExitHere:
   Exit Function
ErrOpenFile:
   Resume ExitHere
End Function

Krgrds,
Perry

> Hi,
>
[quoted text clipped - 9 lines]
> Thanks,
> Jille
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.