View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jake Marx[_3_] Jake Marx[_3_] is offline
external usenet poster
 
Posts: 860
Default How to popup msgbox in this

Hi vumian,

Are you looking for a file that may be open in another application (I see
you're looking for a filename with extension "doc")? If so, this won't
work. The function below only checks for Excel workbooks with the given
name that are open.

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]


vumian wrote:
it's has a little problem

Public Function gbIsWBOpen(rsName As String) As Boolean
On Error Resume Next
gbIsWBOpen = Len(Workbooks(rsName).Name)
On Error GoTo 0
End Function

sub abc()
if gbIsWBOpen("filename.doc")=true then
do function
else
msgbox "error"
end if

What's wrong with this sub abc() ???

thanks your help.