A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hi,
the below method
Set fs = Application.FileSearch
is supported only in xl2003/2002 version(s)
so,
you have the Run-time error '445'
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
We are experiencing an issue with a delivered PeopleSoft nVision StyleSheets macro that was probably carried over from Excel 2003 or earlier. Our nVision environment is now using Excel 2007. However, many users have Excel 2010 or 2016 installed on their computers. The StyleSheeets macro is used to format PS nVision layouts (Excel file). The StyleSheets templates are saved under a specific directory that is set up under the configuration for nVision in the PeopleSoft Application Designer program.
I have a very limited understanding of VBA and would greatly appreciate some guidance.
The run-time error 445 is first generated when the macro to Open Style Sheets is selected. When debug is selected, the "Unload StyleTypes" line is highlighted -
'******************************************************************
' Activates the Style Sheet creation wizard
'******************************************************************
Sub OpenStyleSheets()
Unload StyleTypes
StyleTypes.Show
End Sub
After additional research, it was discovered that FileSearch is usually the cause of this run-time error. When the code was searched for FileSearch, the following code was found -
' ******************************************************************
' Retrieves all valid Style sheets.
' ******************************************************************
Sub GetStyleTypes()
Dim Dirlen As Integer
Dim f, f1, fc, s
Dim iFileCount As Integer
Dim strTemp As String
iFileCount = 0
GetDirectory
Set fs = Application.FileSearch
With fs
.LookIn = Directory
.FileType = msoFileTypeExcelWorkbooks
If .Execute > 0 Then
iFileCount = .FoundFiles.Count
For i = 1 To iFileCount
Dirlen = Len(.LookIn) + 2
strTemp = Mid(.FoundFiles(i), Dirlen)
StyleBox.AddItem (strTemp)
Next i
End If
End With
If iFileCount = 0 Then
Set fs = Nothing
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(Directory)
Set fc = f.Files
For Each f1 In fc
If UCase(Right((f1.Name), 4)) = ".XLS" Then
iFileCount = iFileCount + 1
Dirlen = Len(Directory) + 2
strTemp = f1.Name
StyleBox.AddItem (strTemp)
End If
Next
End If
cleanup:
Set fs = Nothing
Set f = Nothing
Set fc = Nothing
End Sub
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Hi,
the below method
Set fs = Application.FileSearch
is supported only in xl2003/2002 version(s)
so,
you have the Run-time error '445'