troubleshooting Question

VBScript to open Excel file with *.xlsx extension

Avatar of Ron Kelly
Ron Kelly asked on
VB ScriptMicrosoft ExcelMicrosoft Office
3 Comments1 Solution744 ViewsLast Modified:
I'm using VBScript to open an Excel file with an *.xlsx extension.


Set objExcel = WScript.CreateObject ("Excel.Application")
objExcel.Visible = false
Set objWb = objExcel.WorkBooks.open("C:\filefolder\filename.xlsx")

I'm getting the error "Excel cannot open the file...because the file format or file extension is not valid."

If I change the format of the Excel file to Excel 2003 (*.xls") the file opens successfully. I have a number of files in xlsx format to open and I don't want to change the extension on these files (other people have access to these files). Any suggestions? I've scoured the internet for solutions and have come up empty.
ASKER CERTIFIED SOLUTION
NorieSenior Associate
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros