Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening multiple Excel files

Status
Not open for further replies.

shnerk

Programmer
Aug 7, 2003
11
US
I have a user who opens 4 or 5 Excel files at a time. She does this by clicking on the file's icon to launch Excel, rather than going to File | Open. After launching multiple instances of Excel.exe, she can no longer open additional files probably due to memory. My question is: Is there a way to get these files to open within the same excel.exe instance, rather than starting up a new Excel window each time a file is double-clicked?
 
shnerk,
AFIK the default for excel is to be opened in only one instance unless you start excel then do file | open for each file. you can verify this by opening a few spread sheets from icons then clicking the top right 'x'. you should see them all close. if you open excel.exe and then choose file open you will have to click 'x' for each opened file.
is the user running any other programs at the time? are these large excel files? how much ram does the machine have?
first suggestions are to decrease file size, increase vm by increasing paging file size.

HTH
longhair
 
I would guess that the problem is this:

Go to Tools>Options and UN-tic the box beside "Windows in Taskbar". If the box is already blank, then nevermind.

Hope that helps,
John
 
shnerk this should work for you.
Add this code to the ThisWorkbook VB Window
Code:
Option Explicit

Private Sub Workbook_Open()
  Application.WindowState = xlMaximized

    'Place above line in each Workbook that will be opened.
    
    'Choices are: xlMaximized, xlNormal, xlMinimized
    'Use xlMinimized to hide them

   Workbooks.Open ("C:\2.xls")
   Workbooks.Open ("C:\3.xls")
   ...
   ...
End Sub

If you want to check first to see if it already open.

Here is code I found here at Tek-Tips

Code:
Private Sub Workbook_Open()
  Application.WindowState = xlMaximized
    'Place above line in each file that will be opened.
    'Choices are: xlMaximized, xlNormal, xlMinimized
    'Use xlMinimized to hide them

  If IsWorkbookOpen("2.xls") Then
    'MsgBox "File ""2.xls"" is open."
  Else
       Workbooks.Open ("C:\2.xls")
  End If
  
End Sub

Function IsWorkbookOpen(AWorkbookPathName As String) As Boolean
Dim wkb As Workbook, users As Variant

'The presence of shared files makes for the possibility that another user
'may have the file open. To test for this, I have inserted additional code
'into Zathras' routine that makes use of the workbook.UserStatus array:
'One obvious drawback to this approach is that you must actually
'open the file to check the .UserStatus property.
'But it is more accurate overall.
'VBAjedi code...Tek-Tips
On Error Resume Next
IsWorkbookOpen = False
   For Each wkb In Workbooks
      If UCase(wkb.Path & "\" & wkb.Name) = UCase(AWorkbookPathName) Then
         IsWorkbookOpen = True
      End If
   Next wkb
   If IsWorkbookOpen = False Then ' See if other user has shared file open
      Set wkb = Workbooks.Open(AWorkbookPathName)
      If Not wkb Is Nothing Then
         users = wkb.UserStatus ' returns an array of user names, access times, and exclusive/shared mode indicator
         If UBound(users, 1) > 1 Then ' multiple users have file open
            IsWorkbookOpen = True
         End If
         wkb.Close
      End If
   End If
End Function

Now you can delete all the other icons, except the one that launches the main code...

Or modify all the files in the same manner.

Hope this helps...



AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Hi shnerk,

If none of the above good advice helps here is my KISS bit!

1. Checkout WORKSPACE (File, Save WORKSPACE) in Excel Help - it is designed for exactly this situation, where a user accesses a number of worksheets, and provides the facilty to open them ALL in ONE step.

2. Show the user about the Previously Used Files list on the File Menu and use Tools, Options, General, and Recently Used File list, and increase it to 9, which makes it a most useful tool.

3. Get a copy of the "Work" Add-in for Excel which provides a separate menu for easy access to regularly used files - this thread at wopr provides more details:


Good Luck!

Peter Moran
 
Special thanks to anotherhiggins! This simple fix was what I was looking for. I'll keep this one filed in my memory banks. Thanks to PeterMoran too. The Work menu add-in may prove useful for some of my other users. Thanks to everyone who replied, you guys rock!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top