DIVINEDAR0956
IS-IT--Management
HELP!!!
I have the following code to open an excel file from access.
Private Sub NewFile()
Dim XLApp As Object
Dim xlWB As Object
Dim xlWB2 As Object
Dim xlWB3 As Object
Set XLApp = CreateObject("Excel.Application"
XLApp.AskToUpdateLinks = False
XLApp.DisplayAlerts = False
Set xlWB = XLApp.Workbooks.Open("C:\COST\WBS_EXCEL50.xls", False)
Set xlWB2 = XLApp.Workbooks.Open("C:\COST\WBS_EXCEL50_2.xls", False)
Set xlWB3 = XLApp.Workbooks.Open("C:\COST\WBS_EXCEL50_3.xls", False)
If xlWB.IsOpen = False Then
xlWB
If xlWB = True Then
xlWB2
xlWB2.Sheets("PROJECT_INFORMATION".Select
If xlWB2.IsOpen = True Then
xlWB3
xlWB3.Sheets("PROJECT_INFORMATION".Select
If xlWB3.IsOpen = True Then
MsgBox "All Available files are In use, Try Later", vbOKCancel
Else
MsgBox "Your File Is Now Open"
End If
End If
End If
End If
xlWB.Sheets("PROJECT_INFORMATION".Select
XLApp.Visible = True 'use this to view excel file
xlWB.Saved = True
XLApp.AskToUpdateLinks = True
XLApp.DisplayAlerts = True
Set XLApp = Nothing
End Sub
If one file is in use I want it to go to the next file and check to see if it is open. If so go to the next file and open it. This works with just one file to open.
So how do I use the IF STATEMENTto choose a file that is not open.
Thank you. Darlene Sippio
dsippio@comtechsystems.com
I have the following code to open an excel file from access.
Private Sub NewFile()
Dim XLApp As Object
Dim xlWB As Object
Dim xlWB2 As Object
Dim xlWB3 As Object
Set XLApp = CreateObject("Excel.Application"
XLApp.AskToUpdateLinks = False
XLApp.DisplayAlerts = False
Set xlWB = XLApp.Workbooks.Open("C:\COST\WBS_EXCEL50.xls", False)
Set xlWB2 = XLApp.Workbooks.Open("C:\COST\WBS_EXCEL50_2.xls", False)
Set xlWB3 = XLApp.Workbooks.Open("C:\COST\WBS_EXCEL50_3.xls", False)
If xlWB.IsOpen = False Then
xlWB
If xlWB = True Then
xlWB2
xlWB2.Sheets("PROJECT_INFORMATION".Select
If xlWB2.IsOpen = True Then
xlWB3
xlWB3.Sheets("PROJECT_INFORMATION".Select
If xlWB3.IsOpen = True Then
MsgBox "All Available files are In use, Try Later", vbOKCancel
Else
MsgBox "Your File Is Now Open"
End If
End If
End If
End If
xlWB.Sheets("PROJECT_INFORMATION".Select
XLApp.Visible = True 'use this to view excel file
xlWB.Saved = True
XLApp.AskToUpdateLinks = True
XLApp.DisplayAlerts = True
Set XLApp = Nothing
End Sub
If one file is in use I want it to go to the next file and check to see if it is open. If so go to the next file and open it. This works with just one file to open.
So how do I use the IF STATEMENTto choose a file that is not open.
Thank you. Darlene Sippio
dsippio@comtechsystems.com