Home > Forum Home > Developing Business Administration Solutions > Run Time Error 438 in Excel 2007 Share

Run Time Error 438 in Excel 2007

Excel Help for Run Time Error 438 In Excel 2007 in Developing Business Administration Solutions


Forum TopicPost Reply Login

Run Time Error 438 In Excel 2007

Rate this:
(3/5 from 1 vote)
ConfusedI just switched to Excel 2007 & getting Run time error 438 at bold & underlined statement below, Can any one help me for solution.


VBA Code:
PTH2 = Left(pth, InStr(1, pth, "CCARI") + 5) & "\SiteWise Workings\"
pth3 = Left(pth, InStr(1, pth, "CCARI") + 5) & "\" & ActiveWorkbook.Name
If Dir(pth3) = "" Then
    msg = MsgBox(PTH2 & vbCr & "is Invalid Path/Folder for this report" & vbCr & "The program requires this file to be loaded from path like \..CCARI\SiteWise Workings\", vbOKOnly, "GMS Finance Automation")
    Exit Sub
End If


Range("B2") = Left(PTH2, Len(PTH2) - 1)

Range("A3") = ""
Range("B3") = ""
Range("a4:B3000").ClearContents
Dim listoffiles As Object

'Cells.Clear
'Set fs = Application.FileSearch(msoFileDialogSaveAs)
'With fs

Set fs = Application.FileDialog(msoFileDialogSaveAs)
With fs

.LookIn = PTH2
.FileName = "*.xls"
.SearchSubFolders = True
If .Execute > 0 Then
    X = 1
    For i = 1 To .FoundFiles.Count
        
        myfile = .FoundFiles(i)
        If InStr(1, myfile, "OtherFiles") = 0 Then
        Sheets("FilesList").Range("B3").Offset(X, 0).Value = Mid(myfile, Len(PTH2), 200)
        If Left(Sheets("FilesList").Range("B3").Offset(X, 0).Value, 1) <> "\" Then
            Sheets("FilesList").Range("B3").Offset(X, 0).Value = "\" & Sheets("FilesList").Range("B3").Offset(X, 0).Value
        End If
        X = X + 1
        End If
    Next i
    
    
End If
End With
 SAS
 Posted by on
 
Replies - Displaying 1 to 1 of 1Order Replies By: Most Recent | Chronological | Highest Rated
Sad
Rate this:
(3/5 from 1 vote)
The object methods are different in Excel 2007.  In this case .LookIn should be changed to:

VBA Code:
.InitialFileName = PTH2

Nevertheless, you will likely encounter other invalid object methods further in the code.

The object members for the FileDialog object in Excel 2007 are:
Methods: Execute, Show
Properties: AllowMultiSelect, AllowMultiSelect, Application, ButtonName, Creator, DialogType, FilterIndex, Filters, InitialFileName, InitialView, Item, Parent, SelectedItems, Title
 Excel Business Forums Administrator
 Posted by on
 Displaying page 1 of 1 

Find relevant Excel templates and add-ins for Run Time Error 438 in Excel 2007 in the