Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Open a file that is already open

Hello.
I'm trying to do 2 things that i explain right away:
1 - I trying to do a VBA function that when you click on a
button, first checks if a certain file is already open,
and if this is true then it doesn't do nothing, and if its
false it opens the file.

2 - How can i open the Start-Run-Browse window with VBA
code?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Open a file that is already open

Brain dead on the second item, but the first ........

Sub Text()

If Not bIsBookOpen("000 Missing Data.xls") Then _
Workbooks.Open FileName:=Path & "000 Missing Data.xls"

Windows("000 Missing Data.xls").Activate

End Sub

Public Function bIsBookOpen(ByRef szBookName As String) As Boolean
'' Checks to see whether a WorkBook is open.

On Error Resume Next
bIsBookOpen = (Len(Workbooks(szBookName).Name) 0)

End Function

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------

Hello.
I'm trying to do 2 things that i explain right away:
1 - I trying to do a VBA function that when you click on a
button, first checks if a certain file is already open,
and if this is true then it doesn't do nothing, and if its
false it opens the file.

2 - How can i open the Start-Run-Browse window with VBA
code?

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Open a file that is already open

This works from a type name in a cell.
Will activate or open if closed.

Sub GetWorkbook()
If ActiveCell.Value = "" Then Exit Sub
workbookname = ActiveCell.Value
On Error GoTo OpenWorkbook
Windows("" & workbookname & ".xls").Activate
Exit Sub
OpenWorkbook:
Workbooks.Open(workbookname & ".xls").RunAutoMacros xlAutoOpen
Exit Sub
End Sub

"luis" wrote in message
...
Hello.
I'm trying to do 2 things that i explain right away:
1 - I trying to do a VBA function that when you click on a
button, first checks if a certain file is already open,
and if this is true then it doesn't do nothing, and if its
false it opens the file.

2 - How can i open the Start-Run-Browse window with VBA
code?

Thanks



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
excel 2003 saved file will not open without a blank workbook open Bob Excel Discussion (Misc queries) 4 November 11th 06 04:24 PM
In Excel - Use Windows Explorer instead of File Open to open file KymY Excel Discussion (Misc queries) 1 August 5th 06 09:59 PM
Open email windows can't open, excel shreadsheet file .xls ? skiz Excel Discussion (Misc queries) 0 October 2nd 05 07:03 PM
file open via IE hyperlink causes already open files to shrink and tile Marc Setting up and Configuration of Excel 0 May 4th 05 08:13 PM
How do I stop Excel from closing the open file each time I open a. Welsin Setting up and Configuration of Excel 3 January 8th 05 11:16 PM


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