Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default URGENT: switch excel workbooks and display msgbox


switch to all open workbooks apart from activeworkbook and othe
windows.

On switching check whether file "MYFILE.xls" is opened or not an
display msgbox saying "MYFILE is opened" else "Not opened"

--
ilyaskaz
-----------------------------------------------------------------------
ilyaskazi's Profile: http://www.excelforum.com/member.php...fo&userid=2396
View this thread: http://www.excelforum.com/showthread.php?threadid=37652

  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default URGENT: switch excel workbooks and display msgbox

Sub TestMyFile()
Const FileName As String = "myfile.xls"
Dim x As Workbook
Dim FileOpen As Boolean

FileOpen = False
For Each x In Workbooks
If UCase(x.Name) = UCase(FileName) Then _
FileOpen = True
Next x

If FileOpen Then
MsgBox "MyFile is open"
Else: MsgBox "MyFile is not open"
End If

End Sub


"ilyaskazi" wrote:


switch to all open workbooks apart from activeworkbook and other
windows.

On switching check whether file "MYFILE.xls" is opened or not and
display msgbox saying "MYFILE is opened" else "Not opened".


--
ilyaskazi
------------------------------------------------------------------------
ilyaskazi's Profile: http://www.excelforum.com/member.php...o&userid=23969
View this thread: http://www.excelforum.com/showthread...hreadid=376525


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default URGENT: switch excel workbooks and display msgbox

Well, since someone has already done what looks like a homework
assignment... {grin}

Function FileIsOpen(Filename As String) As Boolean
On Error Resume Next
FileIsOpen = Not (Workbooks(Filename) Is Nothing)
End Function
Sub testIt2()
MsgBox FileIsOpen("book2")
MsgBox FileIsOpen("xxxxxx")
End Sub

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...

switch to all open workbooks apart from activeworkbook and other
windows.

On switching check whether file "MYFILE.xls" is opened or not and
display msgbox saying "MYFILE is opened" else "Not opened".


--
ilyaskazi
------------------------------------------------------------------------
ilyaskazi's Profile:
http://www.excelforum.com/member.php...o&userid=23969
View this thread: http://www.excelforum.com/showthread...hreadid=376525


Reply
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
How to display remaining txt file which overflowed MsgBox display? EagleOne Excel Discussion (Misc queries) 1 November 2nd 06 01:10 PM
Using alt-tab to switch between Excel workbooks under the same session Kjetil Excel Discussion (Misc queries) 0 June 22nd 06 03:39 PM
MsgBox - How to display In Other Instance of Excel Alan Excel Programming 8 August 19th 04 10:49 PM
Excel VBA - MsgBox to display variable value? BruceAtkinson[_5_] Excel Programming 2 June 4th 04 08:32 PM
Switch Workbooks Ronbo Excel Programming 1 February 29th 04 06:58 PM


All times are GMT +1. The time now is 04:04 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"