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

admin howto-123.com on November 28th, 2013

Run-time error 445 Object doesn’t support this action. Pesan Error ini saya temukan ketika saya ditanya sebuah file excel macro dari rekan kerja. File tersebut dibuat dengan file excel 2003. Kejadian¬†Run-time error 445 ini mulai terjadi sejak seluruh Personal Computer atau Notebook diupgrade menjadi Windows Vista 8 dan seluruh office menjadi excel 2010.

run time error 445 display

run time error 445 pop up

Setelah saya cek, ternyata ada satu fungsi di macro yang menonaktifkan Application.FileSearch sehingga muncul tampilan error Run-time error 445 Object doesn’t support this action seperti ini :



Sub FindFile()
Dim i, n As Byte, Tmp As String, fs
Set fs = CreateObject("Scripting.FileSystemObject")
Menu.Range("_ShowFiles").ClearContents 'TEMPAT LIST FILE
If Range("_file") = "" Then
MsgBox "Anda harus mengisi nama File !!!"
Else

'--JWB start

'Option Explicit
'Sub GetFileNames()
Dim xRow As Long
Dim xDirect$, xFname$, InitialFoldr$
'InitialFoldr$ = "C:\" '<<< Startup folder to begin searching from
FolderInput = Range("_sources")
InitialFoldr$ = FolderInput
Cells(8, 3).Select

With Application.FileDialog(msoFileDialogFolderPicker)
.InitialFileName = Application.DefaultFilePath & "\"
.Title = "Please select a folder to list Files from"
.InitialFileName = InitialFoldr$
'.Show
If .SelectedItems.Count <> 0 Then
xDirect$ = .SelectedItems(1) & "\"
'xFname$ = Dir(xDirect$, 7)
xFname$ = Dir(xDirect$)
Do While xFname$ <> ""
ActiveCell.Select
ActiveCell.Offset(xRow) = xFname$

xFname$ = Dir
'Cells(8 + xRow, 3).Value = xFname$
xRow = xRow + 1

Loop
End If
End With
'End Sub

'--JWB end

'--JWB1 start
'If .Execute(SortBy:=msoSortByFileName, 'SortOrder:=msoSortOrderAscending) > 0 Then
If xRow > 1 Then
'ReDim FileDitemukan1(1 To .FoundFiles.Count)
ReDim FileDitemukan1(1 To xRow)
'For i = 1 To .FoundFiles.Count
For i = 1 To xRow
'FileDitemukan1(i).NamaFile = .FoundFiles(i)
xFname$ = Cells(8, 3).Value
FileDitemukan1(i).NamaFile = xFname$

Next i
Else
ReDim FileDitemukan1(0 To 0)
MsgBox "Tidak ada file " & NamaFile1 & vbCrLf & _
" di folder :" & Folder1 & vbCrLf, vbCritical + vbOKOnly, "SAP SQL Generate"
End If

'--JWB2 end

If LBound(FileDitemukan1) = 0 And UBound(FileDitemukan1) = 0 Then
MsgBox "Tidak ada file untuk di export !!!"
Else
For g = 1 To UBound(FileDitemukan1)
Application.ScreenUpdating = False
'Cells(g + 7, 3).Value = Mid(FileDitemukan1(g).NamaFile, PanjangPath + 1, 150)
Cells(g + 7, 3).Value = Mid(Cells(g + 7, 3).Value, PanjangPath + 1, 150)
Application.DisplayAlerts = False
Cells(g + 7, 3).Activate
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:=""
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:=FileDitemukan1(g).NamaFile
FileDitemukan1(g).Proses = False
Next g
End If
End If
End Sub

Untuk mengetahui lebih lanjut apa arti kode tersebut, silakan ikuti tutorial sebelumnya. Semoga tutorial tentang Run time error 445 ini bermanfaat.

Leave a Reply