Consulting

Results 1 to 3 of 3

Thread: Solved: Readonly

  1. #1

    Solved: Readonly

     
    Private Sub GatherStage1()
        Application.DisplayAlerts = False
            Application.DisplayStatusBar = True
                Application.StatusBar = "Preparing Reports"
    
        Dim i As Integer, wb As Workbook
        
        With Application.FileSearch
            .NewSearch
            .LookIn = "\\ukhdat\Calling\"
            .SearchSubFolders = True
            .Filename = "*.xls"
            .Application.DisplayAlerts = False
            .Execute
        For i = 1 To .FoundFiles.Count
        
        Set wb = Workbooks.Open(Filename:=.FoundFiles(i))
        
        Run "GatherStage2"
        
        wb.Close savechanges:=False
        
        Next i
        End With
        Application.ScreenUpdating = True
            Application.StatusBar = False
        
    End Sub
    Hi this bit of code works perfectly however I need to go into the file readonly .. can anyone help?

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Set wb = Workbooks.Open(Filename:=.FoundFiles(i), Readonly:=True)
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    thanks worked great

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •