Avatar of Ron Kelly
Ron Kelly

asked on 

VBScript to open Excel file with *.xlsx extension

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.
VB ScriptMicrosoft ExcelMicrosoft Office

Avatar of undefined
Last Comment
Norie
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Ron Kelly
Ron Kelly

ASKER

Bless you. That worked. Thanks Norie!
Avatar of Norie
Norie

Comment was apparently accepted as solution.
Microsoft Excel
Microsoft Excel

Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.

144K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo