L
Lucas Soler
Excel won't open on my first attempt (nothing appears to happen). On my
second attempt, opens OK. Code to follow. Any ideas why Excel won't
initiate at first attempt?
Sub AAASMI_Time_Collection_v1()
Set Proj = ActiveProject
ViewApply Name:="SMI - WBS Structure"
'ViewApply Name:="Resource Usage"
Set xlApp = GetObject(, "Excel.Application") 'Look for running copy
If xlApp Is Nothing Then
Set xlApp = CreateObject("Excel.Application") 'Start new instance
If xlApp Is Nothing Then
MsgBox "Can't Find Excel, please try again.", vbCritical
End 'Stop, can't proceed without Excel
End If
xlApp.Visible = True
Else
Set xlR = Nothing
Set xlApp = Nothing
Set xlBook = Nothing
Set xlApp = CreateObject("Excel.Application") ' Start New Instance
If xlApp Is Nothing Then
MsgBox "Can't Find Excel, please try again.", vbCritical
End 'Stop, can't proceed without Excel
End If
xlApp.Visible = True
End If
Application.ActivateMicrosoftApp pjMicrosoftExcel
On Error Resume Next
second attempt, opens OK. Code to follow. Any ideas why Excel won't
initiate at first attempt?
Sub AAASMI_Time_Collection_v1()
Set Proj = ActiveProject
ViewApply Name:="SMI - WBS Structure"
'ViewApply Name:="Resource Usage"
Set xlApp = GetObject(, "Excel.Application") 'Look for running copy
If xlApp Is Nothing Then
Set xlApp = CreateObject("Excel.Application") 'Start new instance
If xlApp Is Nothing Then
MsgBox "Can't Find Excel, please try again.", vbCritical
End 'Stop, can't proceed without Excel
End If
xlApp.Visible = True
Else
Set xlR = Nothing
Set xlApp = Nothing
Set xlBook = Nothing
Set xlApp = CreateObject("Excel.Application") ' Start New Instance
If xlApp Is Nothing Then
MsgBox "Can't Find Excel, please try again.", vbCritical
End 'Stop, can't proceed without Excel
End If
xlApp.Visible = True
End If
Application.ActivateMicrosoftApp pjMicrosoftExcel
On Error Resume Next