J
Jack
Which one is better (safer) way to do:
1.
If moExcelApp.Workbooks.Count > 0 Then 'when any sheet is opened
Set moExcelWS = moExcelApp.ActiveWorkbook.ActiveSheet
End if
or
2.
If moExcelApp.Workbooks.Count > 0 Then 'when any sheet is opened
Set moExcelWS = moExcelApp.moExcelApp.Workbooks(1).Worksheets(1)
End if
Jack
1.
If moExcelApp.Workbooks.Count > 0 Then 'when any sheet is opened
Set moExcelWS = moExcelApp.ActiveWorkbook.ActiveSheet
End if
or
2.
If moExcelApp.Workbooks.Count > 0 Then 'when any sheet is opened
Set moExcelWS = moExcelApp.moExcelApp.Workbooks(1).Worksheets(1)
End if
Jack