How to distinguish an Excel 2 Worksheets

Hi there,

So what I am wanting to do is write a powershell script to help my team convert several hundred Excel 2 workbooks to Excel 2007 Worksheet. Due to security reasons our company has blocked all the Excel 1, 2, 3, 4 workbooks from opening. Any ideas on how I would go about getting powershell to find and convert these files ?

if the file types sound confusing I am looking at the file types from: Excel > File > Options > Trust Centre > Trust Centre Settings > File Block Settings.

Mid way down there are a lot of items which are classed as "Excel 2 Workbook" and "Excel 3 Workbook" 

As above I'm just looking at a way we can get powershell to find and convert the items to a new 2007 format. any help would be greatly appreciated

May 14th, 2015 6:05am

If you can change the setting in your trust center, then you could use a macro:

Sub Transform2003to2007()
    Dim vFileArray As Variant
    Dim wkbkTemp As Workbook
    
    Application.DisplayAlerts = False
    
    vFileArray = Application.GetOpenFilename(MultiSelect:=True)
    If IsArray(vFileArray) Then
        For i = LBound(vFileArray) To UBound(vFileArray)
            If Right(vFileArray(i), 4) = ".xls" Then
                Set wkbkTemp = Workbooks.Open(vFileArray(i))
                wkbkTemp.SaveAs vFileArray(i) & "m", FileFormat:=xlOpenXMLWorkbookMacroEnabled
                wkbkTemp.Close False
            Else
                MsgBox "This file: " & Chr(10) & vFileArray(i) & Chr(10) & "will not be processed."
            End If
        Next i
    End If
    
End Sub

Free Windows Admin Tool Kit Click here and download it now
May 14th, 2015 9:25am

Hi Bitbytex,

Please try Bernie's suggestion first and check if it's helpful.  If you have any further question about powershell script, I recommend you post the question to the MSDN forum for Excel

http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc

The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

 George Zhao
TechNet Community Support

May 20th, 2015 4:26am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics