I had the following code that works perfectly for .xls files by running CmdOpenExcel () macro:
Private Sub CmdOpenExcel_Click()
Function CmdOpenExcel()
'Williford - opens the specified Spreadsheet
Dim xlApp As Excel.Application
Dim xlWB As Excel.Workbook
Set xlApp = New Excel.Application
With xlApp
.Visible = True
Set xlWB = .Workbooks.Open("C:\Documents and Settings\Template.xls", , False)
End With
End Function
But when I change the file type to 2007 .xlsx or .xlsm (see below), the open command fails.
Set xlWB = .Workbooks.Open("C:\Documents and Settings\Template.xlsx", , False)
Can anyone help?