ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to popup msgbox in this (https://www.excelbanter.com/excel-programming/368422-how-popup-msgbox.html)

vumian[_17_]

How to popup msgbox in this
 

How to check any file active or not

if window("file.abc").active = true then
do function
else
msgbox "error"
end if

what's wrong with this ?

thank you


--
vumian
------------------------------------------------------------------------
vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494
View this thread: http://www.excelforum.com/showthread...hreadid=565232


Jake Marx[_3_]

How to popup msgbox in this
 
Hi vumian,

To check to see if a named workbook is currently open, you could use this
function:

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

--
Regards,

Jake Marx
www.longhead.com


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

vumian wrote:
How to check any file active or not

if window("file.abc").active = true then
do function
else
msgbox "error"
end if

what's wrong with this ?

thank you




vumian[_19_]

How to popup msgbox in this
 

hi Jake Marx,

it's great man, thank you very much.
Brgds

--
vumia
-----------------------------------------------------------------------
vumian's Profile: http://www.excelforum.com/member.php...fo&userid=3649
View this thread: http://www.excelforum.com/showthread.php?threadid=56523


vumian[_18_]

How to popup msgbox in this
 

hi Jake Marx,

it's great man, thank you very much.
Brgds,


--
vumian
------------------------------------------------------------------------
vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494
View this thread: http://www.excelforum.com/showthread...hreadid=565232


vumian[_20_]

How to popup msgbox in this
 

hi Jake Marx,

it's great man, thank you very much.
Brgds

--
vumia
-----------------------------------------------------------------------
vumian's Profile: http://www.excelforum.com/member.php...fo&userid=3649
View this thread: http://www.excelforum.com/showthread.php?threadid=56523


vumian[_23_]

How to popup msgbox in this
 

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.


--
vumian
------------------------------------------------------------------------
vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494
View this thread: http://www.excelforum.com/showthread...hreadid=565232


Jake Marx[_3_]

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.




vumian[_32_]

How to popup msgbox in this
 

hi man,

no man, i wrote above, it's just a example :))
atually, i'm not looking for a filename with extension "doc", just xls
only
but it has not worked so far , hixhix :(

i wanna check if that file is not opened,
how to msgbox for this ??
help me pls.


--
vumian
------------------------------------------------------------------------
vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494
View this thread: http://www.excelforum.com/showthread...hreadid=565232


Jake Marx[_3_]

How to popup msgbox in this
 
Hi vumian,

vumian wrote:
no man, i wrote above, it's just a example :))
atually, i'm not looking for a filename with extension "doc", just xls
only
but it has not worked so far , hixhix :(

i wanna check if that file is not opened,
how to msgbox for this ??
help me pls.


Your code should work - it does for me. For a workbook that has been saved
before, you should always use .xls at the end of the filename when you're
checking to see if it's part of the active Workbooks collection. So if you
have a workbook named filename.xls that you want to check for, you would use
gbIsWBOpen("filename.xls"), which will return True if the workbook is open
and False if it's not.

--
Regards,

Jake Marx
www.longhead.com


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




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com