-
WSIvan F Moala
AskWoody LoungerYou may have inadvertenly turned it off by clearing the status bar area ….
You can try turning it back on via code.Application.StatusBar = False
-
WSIvan F Moala
AskWoody LoungerOk try this amended code
Sub TestVBA()
'// Just change the file to test here
Const strFileToOpen As String = "C:Data.xls"If IsFileOpen(strFileToOpen) Then
MsgBox strFileToOpen & " is already Open" & _
vbCrLf & "By " & LastUser(strFileToOpen), vbInformation, "File in Use"
Else
MsgBox strFileToOpen & " is not open", vbInformation
End If
End SubFunction IsFileOpen(strFullPathFileName As String) As Boolean
'// VBA version to check if File is Open
'// We can use this for ANY FILE not just Excel!
'// Ivan F Moala
'// http://www.xcelfiles.com
Dim hdlFile As Long'// Error is generated if you try
'// opening a File for ReadWrite lock >> MUST BE OPEN!
On Error GoTo FileIsOpen:
hdlFile = FreeFile
Open strFullPathFileName For Random Access Read Write Lock Read Write As hdlFile
IsFileOpen = False
Close hdlFile
Exit Function
FileIsOpen:
'// Someone has it open!
IsFileOpen = True
Close hdlFile
End FunctionPrivate Function LastUser(strPath As String) As String
'// Code by Helen from http://www.visualbasicforum.com/index.php?s=
'// This routine gets the Username of the File In Use
'// Credit goes to Helen for code & Mark for the idea
'// Insomniac for xl97 inStrRev
'// Amendment 25th June 2004 by IFM
'// : Name changes will show old setting
'// : you need to get the Len of the Name stored just before
'// : the double Padded Nullstrings
Dim strXl As String
Dim strFlag1 As String, strflag2 As String
Dim i As Integer, j As Integer
Dim hdlFile As Long
Dim lNameLen As BytestrFlag1 = Chr(0) & Chr(0)
strflag2 = Chr(32) & Chr(32)hdlFile = FreeFile
Open strPath For Binary As #hdlFile
strXl = Space(LOF(hdlFile))
Get 1, , strXl
Close #hdlFilej = InStr(1, strXl, strflag2)
#If Not VBA6 Then
'// Xl97
For i = j - 1 To 1 Step -1
If Mid(strXl, i, 1) = Chr(0) Then Exit For
Next
i = i + 1
#Else
'// Xl2000+
i = InStrRev(strXl, strFlag1, j) + Len(strFlag1)
#End If'// IFM
lNameLen = Asc(Mid(strXl, i - 3, 1))
LastUser = Mid(strXl, i, lNameLen)End Function
The Username code works on the fact that a workbook opened by a User gets certain info written to it
eg Username. What this code does is to search the file for 2 consecutive spaces chr(32) and works backwards from that possition
until the End of string disignator = 2 vbnullstrings. The character just before this is actually the length of the Username. -
WSIvan F Moala
AskWoody LoungerOk try this amended code
Sub TestVBA()
'// Just change the file to test here
Const strFileToOpen As String = "C:Data.xls"If IsFileOpen(strFileToOpen) Then
MsgBox strFileToOpen & " is already Open" & _
vbCrLf & "By " & LastUser(strFileToOpen), vbInformation, "File in Use"
Else
MsgBox strFileToOpen & " is not open", vbInformation
End If
End SubFunction IsFileOpen(strFullPathFileName As String) As Boolean
'// VBA version to check if File is Open
'// We can use this for ANY FILE not just Excel!
'// Ivan F Moala
'// http://www.xcelfiles.com
Dim hdlFile As Long'// Error is generated if you try
'// opening a File for ReadWrite lock >> MUST BE OPEN!
On Error GoTo FileIsOpen:
hdlFile = FreeFile
Open strFullPathFileName For Random Access Read Write Lock Read Write As hdlFile
IsFileOpen = False
Close hdlFile
Exit Function
FileIsOpen:
'// Someone has it open!
IsFileOpen = True
Close hdlFile
End FunctionPrivate Function LastUser(strPath As String) As String
'// Code by Helen from http://www.visualbasicforum.com/index.php?s=
'// This routine gets the Username of the File In Use
'// Credit goes to Helen for code & Mark for the idea
'// Insomniac for xl97 inStrRev
'// Amendment 25th June 2004 by IFM
'// : Name changes will show old setting
'// : you need to get the Len of the Name stored just before
'// : the double Padded Nullstrings
Dim strXl As String
Dim strFlag1 As String, strflag2 As String
Dim i As Integer, j As Integer
Dim hdlFile As Long
Dim lNameLen As BytestrFlag1 = Chr(0) & Chr(0)
strflag2 = Chr(32) & Chr(32)hdlFile = FreeFile
Open strPath For Binary As #hdlFile
strXl = Space(LOF(hdlFile))
Get 1, , strXl
Close #hdlFilej = InStr(1, strXl, strflag2)
#If Not VBA6 Then
'// Xl97
For i = j - 1 To 1 Step -1
If Mid(strXl, i, 1) = Chr(0) Then Exit For
Next
i = i + 1
#Else
'// Xl2000+
i = InStrRev(strXl, strFlag1, j) + Len(strFlag1)
#End If'// IFM
lNameLen = Asc(Mid(strXl, i - 3, 1))
LastUser = Mid(strXl, i, lNameLen)End Function
The Username code works on the fact that a workbook opened by a User gets certain info written to it
eg Username. What this code does is to search the file for 2 consecutive spaces chr(32) and works backwards from that possition
until the End of string disignator = 2 vbnullstrings. The character just before this is actually the length of the Username. -
WSIvan F Moala
AskWoody LoungerThis Worked for me Xl2003 / WinXp
Sub TestVBA() '// Just change the file to test here Const strFileToOpen As String = "C:Data.xls" If IsFileOpen(strFileToOpen) Then MsgBox strFileToOpen & " is already Open" & _ vbCrLf & "By " & LastUser(strFileToOpen), vbInformation, "File in Use" MsgBox ActiveWorkbook.WriteReservedBy Else MsgBox strFileToOpen & " is not open" MsgBox ActiveWorkbook.WriteReservedBy End If End Sub Function IsFileOpen(strFullPathFileName As String) As Boolean '// VBA version to check if File is Open '// We can use this for ANY FILE not just Excel! '// Ivan F Moala '// http://www.xcelfiles.com Dim hdlFile As Long '// Error is generated if you try '// opening a File for ReadWrite lock >> MUST BE OPEN! On Error GoTo FileIsOpen: hdlFile = FreeFile Open strFullPathFileName For Random Access Read Write Lock Read Write As hdlFile IsFileOpen = False Close hdlFile Exit Function FileIsOpen: '// Someone has it open! IsFileOpen = True Close hdlFile End Function Function LastUser(strPath As String) As String '// Code by Helen from http://www.visualbasicforum.com/index.php?s= '// This routine gets the Username of the File In Use '// Credit goes to Helen & Mike for the idea Dim text As String Dim strFlag1 As String, strflag2 As String Dim i As Integer, j As Integer strFlag1 = Chr(0) & Chr(0) strflag2 = Chr(32) & Chr(32) Open strPath For Binary As #1 text = Space(LOF(1)) Get 1, , text Close #1 j = InStr(1, text, strflag2) i = InStrRev(text, strFlag1, j) + Len(strFlag1) LastUser = Mid(text, i, j - i) End Function
-
WSIvan F Moala
AskWoody LoungerThis Worked for me Xl2003 / WinXp
Sub TestVBA() '// Just change the file to test here Const strFileToOpen As String = "C:Data.xls" If IsFileOpen(strFileToOpen) Then MsgBox strFileToOpen & " is already Open" & _ vbCrLf & "By " & LastUser(strFileToOpen), vbInformation, "File in Use" MsgBox ActiveWorkbook.WriteReservedBy Else MsgBox strFileToOpen & " is not open" MsgBox ActiveWorkbook.WriteReservedBy End If End Sub Function IsFileOpen(strFullPathFileName As String) As Boolean '// VBA version to check if File is Open '// We can use this for ANY FILE not just Excel! '// Ivan F Moala '// http://www.xcelfiles.com Dim hdlFile As Long '// Error is generated if you try '// opening a File for ReadWrite lock >> MUST BE OPEN! On Error GoTo FileIsOpen: hdlFile = FreeFile Open strFullPathFileName For Random Access Read Write Lock Read Write As hdlFile IsFileOpen = False Close hdlFile Exit Function FileIsOpen: '// Someone has it open! IsFileOpen = True Close hdlFile End Function Function LastUser(strPath As String) As String '// Code by Helen from http://www.visualbasicforum.com/index.php?s= '// This routine gets the Username of the File In Use '// Credit goes to Helen & Mike for the idea Dim text As String Dim strFlag1 As String, strflag2 As String Dim i As Integer, j As Integer strFlag1 = Chr(0) & Chr(0) strflag2 = Chr(32) & Chr(32) Open strPath For Binary As #1 text = Space(LOF(1)) Get 1, , text Close #1 j = InStr(1, text, strflag2) i = InStrRev(text, strFlag1, j) + Len(strFlag1) LastUser = Mid(text, i, j - i) End Function
-
WSIvan F Moala
AskWoody LoungerYes, and I stated that when posting.
Original Q was
” need to extract a filename from a string…..” -
WSIvan F Moala
AskWoody LoungerYes, and I stated that when posting.
Original Q was
” need to extract a filename from a string…..” -
WSIvan F Moala
AskWoody LoungerMsgBox Dir(“C:ExcelFilesHelpactionscript_dict.pdf”)
Will yield the File name if it exists
-
WSIvan F Moala
AskWoody LoungerMsgBox Dir(“C:ExcelFilesHelpactionscript_dict.pdf”)
Will yield the File name if it exists
-
WSIvan F Moala
AskWoody LoungerThe above Requires
shell32.dll version 4.71 or later
Minimum operating systems: Windows -
WSIvan F Moala
AskWoody LoungerAugust 4, 2002 at 6:00 am in reply to: HTMLMaker add-in problem (2000)-MULTI-HTMLMaker add-in probl #605877Hyperlinks added- Mod
Hi Alan
You are probably missing the IeTimer……
It’s available at;
http://activex.microsoft.com/controls/iexp…x86/ietimer.cab%5B/url%5D
(After download it has to be registered with regsvr32)
You can use the Regsvr32 tool (Regsvr32.exe) to register and unregister
object linking and embedding (OLE) controls such as dynamic-link
library (DLL) or ActiveX Controls (OCX) files that are
self-registerable.Windows Taskbar
Click > Start
> Run
Typein > Regsvr32 ietimer.ocxIf not successfull here then try explicitly
setting the paths eg.CWindowsSystemRegsvr32 C:WindowsSystemietimer.ocx
Regsvr32.exe is included with Microsoft Internet Explorer 3.0 or later,
Windows 95 OEM Service Release 2 (OSR2) or later,
and Windows NT 4.0 Service Pack 5 (SP5) or later.
Regsvr32.exe is installed in the System (Windows Me/98/95) or System32 (Windows NT) folder.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
WARNING about Nvidia driver version 572.83 and 4000/5000 series cards
by
Bob99
2 hours, 48 minutes ago -
Creating an Index in Word 365
by
CWBillow
2 hours, 54 minutes ago -
Coming at Word 365 and Table of Contents
by
CWBillow
2 hours, 58 minutes ago -
Windows 11 Insider Preview Build 22635.5170 (23H2) released to BETA
by
joep517
7 hours, 55 minutes ago -
Has the Microsoft Account Sharing Problem Been Fixed?
by
jknauth
11 hours, 20 minutes ago -
W11 24H2 – Susan Bradley
by
G Pickerell
13 hours, 16 minutes ago -
7 tips to get the most out of Windows 11
by
Alex5723
11 hours, 17 minutes ago -
Using Office apps with non-Microsoft cloud services
by
Peter Deegan
4 hours, 39 minutes ago -
I installed Windows 11 24H2
by
Will Fastie
2 hours, 57 minutes ago -
NotifyIcons — Put that System tray to work!
by
Deanna McElveen
16 hours, 43 minutes ago -
Decisions to be made before moving to Windows 11
by
Susan Bradley
3 hours, 39 minutes ago -
Port of Seattle says ransomware breach impacts 90,000 people
by
Nibbled To Death By Ducks
1 day ago -
Looking for personal finance software with budgeting capabilities
by
cellsee6
9 hours, 10 minutes ago -
ATT/Yahoo Secure Mail Key
by
Lil88reb
9 hours, 25 minutes ago -
Devices with apps using sprotect.sys driver might stop responding
by
Alex5723
1 day, 18 hours ago -
Neowin – 20 times computers embarrassed themselves with public BSODs and goofups
by
EP
2 days, 2 hours ago -
Slow Down in Windows 10 performance after March 2025 updates ??
by
arbrich
1 day, 4 hours ago -
Mail from certain domains not delivered to my outlook.com address
by
pumphouse
1 day, 10 hours ago -
Is data that is in OneDrive also taking up space on my computer?
by
WShollis1818
1 day, 21 hours ago -
Nvidia just fixed an AMD Linux bug
by
Alex5723
3 days, 13 hours ago -
50 years and counting
by
Susan Bradley
11 hours, 35 minutes ago -
Fix Bluetooth Device Failed to Delete in Windows Settings
by
Drcard:))
14 hours, 23 minutes ago -
Licensing and pricing updates for on-premises server products coming July 2025
by
Alex5723
4 days ago -
Edge : Deprecating window.external.getHostEnvironmentValue()
by
Alex5723
4 days ago -
Rethinking Extension Data Consent: Clarity, Consistency, and Control
by
Alex5723
4 days ago -
OneNote and MS Word 365
by
CWBillow
4 days, 2 hours ago -
Ultimate Mac Buyers Guide 2025: Which Mac is Right For You?
by
Alex5723
4 days, 2 hours ago -
Intel Unison support ends on Windows 11 in June
by
Alex5723
4 days, 2 hours ago -
April 2025 — still issues with AMD + 24H2
by
Kevin Jones
1 day, 18 hours ago -
Windows 11 Insider Preview build 26200.5518 released to DEV
by
joep517
4 days, 14 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.