Share via

Run-time error '445' - Object doesn't support this action

Anonymous
2016-05-11T14:45:04+00:00

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

Microsoft 365 and Office | Excel | For home | Windows

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.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2016-05-13T04:55:08+00:00

    Hi,

    the below method

    Set fs = Application.FileSearch

    is supported only in xl2003/2002 version(s)

    so,

    you have the Run-time error '445'

    Was this answer helpful?

    6 people found this answer helpful.
    0 comments No comments