LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default update links - source file open

'/================================================/
' Function Purpose: Returns TRUE if workbook is open
' Returns FALSE if workbook is NOT open
' syntax of strWkbkName is FULL Name
' example: "D:\Temp\Hello.xls"
' strWkbkName must be a string
'
'/================================================/
Public Function WorkbookIsOpen(strWkbkName As String) As Boolean
Dim blnResult As Boolean
Dim iWorkbooks As Double, x As Double

On Error GoTo err_Function

blnResult = False

'count number of open workbooks
iWorkbooks = Application.Workbooks.Count
If iWorkbooks < 1 Then
GoTo exit_Function
End If

For x = 1 To iWorkbooks
If Application.Workbooks(x).FullName = strWkbkName Then
blnResult = True
End If
Next x

WorkbookIsOpen = blnResult

exit_Function:
On Error Resume Next
Exit Function

err_Function:
Debug.Print "Error: " & Err.Number & " - (" & _
Err.Description & _
") - Function: WorkbookIsOpen - " & _
"Module: Mod_Functions_WorkbookIsOpen - " & Now()
GoTo exit_Function

End Function
'/================================================/

--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"KB" wrote:

Is there a way in VBA to detect if the source file for a specific link is open?

 
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
External workbook links don't update when source file changes Lori Lynn Excel Worksheet Functions 1 November 19th 08 06:14 PM
Why will links not update unless source is open? WesJFrank Excel Discussion (Misc queries) 4 August 3rd 07 03:14 PM
** Links don't update UNLESS source file is open Jack Links and Linking in Excel 1 July 27th 05 02:02 PM
** Links don't update UNLESS source file is open Jack Links and Linking in Excel 0 July 14th 05 05:55 PM
Automatic update of links in destination file when source file mo. Brucgil Excel Discussion (Misc queries) 0 December 2nd 04 04:07 PM


All times are GMT +1. The time now is 01:53 AM.

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"