khalid79m
06-17-2011, 01:49 AM
Private Sub Emulator()
Dim StartLocation As String
Dim EndLocation1 As String
Dim EndLocation2 As String
Dim TLOpenLocation As String
Dim objExcel As Excel.Application
StartLocation = "\\aad\dsf.xls (file://aad/dsf.xls)" 'Strategic Soloution
On Error GoTo Z:
If Dir(StartLocation) <> "" Then 'Stage 1 Check if the StartLocation Exsists , if it does open the Strategic Soloution
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Open StartLocation
Else 'If Strategic not available then open tactical as below
StartLocation = "\\zzz\ (file://zzz/) ss.xls"
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Open StartLocation
End If
Z:
ThisWorkbook.Close False
End Sub
I have this code in an excel file which opens another excel application and then opens a file within that session of excel, however when I come to this line
ThisWorkbook.Close False
which is intented to close the first file that open the new excel session I get this
Micrsoft office excel is wating for another application to complete an OLE action
Please note the file being opened is a form based application.
Dim StartLocation As String
Dim EndLocation1 As String
Dim EndLocation2 As String
Dim TLOpenLocation As String
Dim objExcel As Excel.Application
StartLocation = "\\aad\dsf.xls (file://aad/dsf.xls)" 'Strategic Soloution
On Error GoTo Z:
If Dir(StartLocation) <> "" Then 'Stage 1 Check if the StartLocation Exsists , if it does open the Strategic Soloution
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Open StartLocation
Else 'If Strategic not available then open tactical as below
StartLocation = "\\zzz\ (file://zzz/) ss.xls"
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Open StartLocation
End If
Z:
ThisWorkbook.Close False
End Sub
I have this code in an excel file which opens another excel application and then opens a file within that session of excel, however when I come to this line
ThisWorkbook.Close False
which is intented to close the first file that open the new excel session I get this
Micrsoft office excel is wating for another application to complete an OLE action
Please note the file being opened is a form based application.