I don't understand why this little bit of code is not working. If the user already has Excel open, it won't work. However, if Excel is not open code will work just fine. Thanks in advance!
Code:
Function funExpanCalendar(strFileLoc As String, strFileName As String, strFileExt As String)
Dim strTableName As String
Dim strVendor As String
Dim xlApp As Object
Dim xlSheet As Object
' Dim c As Range, lr As Long
Dim ExcelRunning As Boolean
ExcelRunning = IsExcelRunning()
If ExcelRunning Then
Set xlApp = GetObject(, "Excel.Application")
gblExcelOpen = True
Else
Set xlApp = CreateObject("Excel.Application")
gblExcelOpen = False
End If
xlApp.Application.DisplayAlerts = False
Set xlSheet = xlApp.Workbooks.Open(strFileLoc & strFileName & strFileExt).Sheets(1)
' gblExcelOpen = True
gblWrkBkOpen = True
'=========================
With xlApp.Application
.Sheets.Add After:=Sheets(Sheets.Count)
.Sheets(Sheets.Count).Select
.Sheets(Sheets.Count).Name = "Data"
.Sheets(1).Select
'.....more code
End With