troubleshooting Question

adding "ungroup sheets" to existing vbs code

Avatar of Culwatrnca11
Culwatrnca11Flag for United States of America asked on
Microsoft OfficeVB ScriptVBAMicrosoft ExcelVisual Basic Classic
5 Comments1 Solution355 ViewsLast Modified:
Found this code for converting XLSX to XLSM which works great on a different project. With this project when I open the excel file I need to "ungroup sheets" in the workbook then save_as xlsm. There are about 6 tabs total if that matters.

I execute it in the same directory as the excel file via a batch file:
start /min /wait "c:\Batch_Automation\xlsxtoxlsm.vbs" "C:\Batch_Automation\CCYY_MM_RUN_MMDDCCYY.xlsx" "C:\Batch_Automation\CCYY_MM_RUN_MMDDCCYY.xlsm"

Question: How do you add ungroup sheets to this code?
File name: XlsxToXlsm.vbs

if WScript.Arguments.Count < 2 Then
    WScript.Echo "Error! Please specify the source path and the destination. Usage: XlsxToxlsm SourcePath.xlsx Destination.xlsm"
End If
Dim oExcel
Set oExcel = CreateObject("Excel.Application")
Dim oBook
Set oBook = oExcel.Workbooks.Open(Wscript.Arguments.Item(0))

oBook.SaveAs WScript.Arguments.Item(1), 52
oBook.Close False

Thank you,
Excel VBA Developer
Join our community to see this answer!
Unlock 1 Answer and 5 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 5 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