Re: $$Excel-Macros$$ Check if two files are open; if not, open them

2010-12-15 Thread 0 1
I love it when simple code works so well. Thank you! -- -- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http:

Re: $$Excel-Macros$$ Check if two files are open; if not, open them

2010-12-15 Thread Paul Schreiner
You could simply: On Error Resume Next Workbooks("File1.xls").Close Workbooks("File2.xls").Close On Error Goto 0 Paul - Original Message > From: 0 1 > To: MS EXCEL AND VBA MACROS > Sent: Wed, December 15, 2010 10:36:02 AM > Subject: Re: $$Excel-Macr

Re: $$Excel-Macros$$ Check if two files are open; if not, open them

2010-12-15 Thread 0 1
Using two separate if-then statements did the trick. But now I have a related problem. I'm trying to reverse the code in order to *close* the sheets, if they are open. I figured I could use the same code for the Function WorkbookOpen ..., but a new subroutine for closing them: Public Sub CloseSou

Re: $$Excel-Macros$$ Check if two files are open; if not, open them

2010-12-07 Thread Paul Schreiner
uot;  End If  If Not WorkbookOpen("File2.xls") Then     Workbooks.Open Filename:="C:\File2.xls"  End If   Paul - Original Message > From: 0 1 > To: MS EXCEL AND VBA MACROS > Sent: Tue, December 7, 2010 10:58:33 AM > Subject: $$Excel-Macros$$ Chec

$$Excel-Macros$$ Check if two files are open; if not, open them

2010-12-07 Thread 0 1
With File3.xls open, I'd like to run a macro that checks if File1.xls and File2.xls are open. If either or both are not open, then open them. The code below evaluates only the first file (File1.xls), and never proceeds to the next step (i.e., it never checks for File2.xls). Any idea what I need to

$$Excel-Macros$$ Check if two files are open; if not, open them

2010-12-07 Thread 0 1
With File3.xls open, I'd like to run a macro that checks if File1.xls and File2.xls are open. If either or both are not open, then open them. The code below evaluates only the first file (File1.xls), and never proceeds to the next step (i.e., it never checks for File2.xls). Any idea what I need to