XLSM Converter
The "M" of XLSM stands for macro. Macros are programs embedded in Office documents used to automate different tasks. Staring from Excel 2007, XLSX spreadsheets that contain macros are saved with the XLSM extension.
Thank you very much for taking the time to reply! I really appreciate it! Pardon my ignorance, but I am not able to figure out the complete code. I only learned VBA from Bill Jelen's book VBA and Macros: Microsoft Excel 2010, but I'm not quite at the level yet to write this particular code. I created an order form that has a macro button to reset the form. I do not want the processed purchase orders we have saved to be opened by my colleagues and for them to accidentally hit the Reset Form button and end up saving it without the data. As well, our shared drive is almost full, and the xlsm files take up more space. They have saved them as xlsm, and I want to save them as xlsx, but there's hundreds of them in the folder. I would like to run a macro that does that for all of them. Your help will be very much appreciated! Thanks!
In .xlsm files are "normal" Microsoft Excel [.xls or .xlsx] files with activated macros. Macros are used to record recurring sequences of commands [for example, mouse movements or keyboard input] and, if necessary, to repeat them automatica …
File extension: .xlsmMore information and converters for XLSM
To: XLSX
XLSX is the file extension of Microsoft's most widely used Excel spreadsheet program. The format has been the successor of the XLS format since 2003. For editing, formulas or formatting commands are entered in the specified table cells, and macr …
File extension: .xlsxMore information and converters for XLSX
Video-Tutorial: XLSM to XLSX
File-Converter-Online.com is a service for converting files online from one type to another. We take care of your privacy and take care of your files. As a part of this, there's no registration required on file-converter-online.com. As we're offering our service in a browser, it does'nt matter whether you use Windows, Apple OS X or Linux. Your conversion results will always be at the same, very high quality and of course, without watermarks.
As I said in my above comment, adding the folder where the workbooks in discussion exist in Excel Trusted Locations
can be a solution, to avoid warnings related to trustful workbooks. Adding the folder path, in code, can be done in the next way:
Private Function CreatePathInTrLoc[ByVal sPath As String, ByVal sDescription As String, Optional boolReplace As Boolean] As Boolean
Const HKEY_CURRENT_USER = &H80000001, sAppExe As String = "excel.exe", sApp As String = "Excel"
Dim oRegistry As Object, sAppVer As String, sParentKey As String, bAlreadyExists As Boolean
Dim arrChildKeys As Variant, sChildKey As Variant, sValue As String, sNewKey As String
Dim iLocCounter As Long, strReplace As String, sExtPath As String
Set oRegistry = GetObject["winmgmts:\\.\root\default:StdRegProv"]
sAppVer = GetAppVersion[sAppExe]
sAppVer = left[sAppVer, InStr[sAppVer, "."] - 1] & "." & Mid[sAppVer, InStr[sAppVer, "."] + 1, 1]
sParentKey = "Software\Microsoft\Office\" & sAppVer & "\" & sApp & "\Security\Trusted Locations"
iLocCounter = 0
oRegistry.EnumKey HKEY_CURRENT_USER, sParentKey, arrChildKeys
For Each sChildKey In arrChildKeys
oRegistry.GetStringValue HKEY_CURRENT_USER, sParentKey & "\" & sChildKey, "Description", sValue
If sValue = sDescription Then
If boolReplace Then
oRegistry.GetStringValue HKEY_CURRENT_USER, sParentKey & "\" & sChildKey, "Path", sExtPath
If sExtPath sPath Then
oRegistry.DeleteKey HKEY_CURRENT_USER, sParentKey & "\" & sChildKey
strReplace = sChildKey
GoTo OverDeleteKey
Else
bAlreadyExists = True
CreatePathInTrLoc = True
End If
Else
bAlreadyExists = True
CreatePathInTrLoc = True
End If
End If
If CInt[Mid[sChildKey, 9]] > iLocCounter Then
iLocCounter = CInt[Mid[sChildKey, 9]]
End If
Next
OverDeleteKey:
If Not bAlreadyExists Then
sNewKey = sParentKey & IIf[strReplace "", "\" & strReplace, "\Location" & CStr[iLocCounter + 1]]
oRegistry.CreateKey HKEY_CURRENT_USER, sNewKey
oRegistry.SetStringValue HKEY_CURRENT_USER, sNewKey, "Path", sPath
oRegistry.SetStringValue HKEY_CURRENT_USER, sNewKey, "Description", sDescription
oRegistry.SetDWORDValue HKEY_CURRENT_USER, sNewKey, "AllowSubFolders", 1
CreatePathInTrLoc = True
Debug.Print "Path """ & sPath & """ added in Trusted Locations."
Else
Debug.Print "Path """ & sPath & """ already exists..."
End If
End Function
Private Function GetAppVersion[sAppExe As String] As String 'extract application version
Const HKEY_LOCAL_MACHINE = &H80000002
Dim oRegistry As Object, oFSO As Object, sKey As String, sValue As String
Set oRegistry = GetObject["winmgmts:{impersonationLevel=impersonate}//./root/default:StdRegProv"]
Set oFSO = CreateObject["Scripting.FileSystemObject"]
sKey = "Software\Microsoft\Windows\CurrentVersion\App Paths"
oRegistry.GetStringValue HKEY_LOCAL_MACHINE, sKey & "\" & sAppExe, "", sValue
GetAppVersion = oFSO.GetFileVersion[sValue]
Set oFSO = Nothing: Set oRegistry = Nothing
End Function
The above solution can be tested as:
Sub testCreatePathInTrLoc[]
Debug.Print CreatePathInTrLoc["C:\temp", "TestLocation"]
End Sub
The called Sub
needs as parameters: folder path to be added, Trusted location name/description and a Boolean
Optional
parameter if you want replacing an existing trusted location.