VBA Save As Dialog

ir121973

Active Member
Joined
Feb 9, 2008
Messages
371
Hi, I wonder whether someone could help me please.

From an article here: Welcome to LearnExcelMacro.com How to get list of All files in a Folder and Sub-folders , I'm using the script below to apply a link to a list of file names which the user can view by clicking on said link.

Code:
Public Sub ListFilesInFolder(SourceFolder As Scripting.folder, IncludeSubfolders As Boolean)
        
    On Error Resume Next
    For Each FileItem In SourceFolder.Files   
        
' display file properties
        Cells(iRow, 2).Formula = iRow - 6
        Cells(iRow, 3).Formula = FileItem.Name
        Cells(iRow, 4).Select
        Selection.Hyperlinks.Add Anchor:=Selection, Address:= _
        FileItem.Path, TextToDisplay:="Click Here to Save"
        
        iRow = iRow + 1 ' next row number
        Next FileItem
        
        If IncludeSubfolders Then
            For Each SubFolder In SourceFolder.SubFolders
                ListFilesInFolder SubFolder, True
                Next SubFolder
            End If
            
            Set FileItem = Nothing
            Set SourceFolder = Nothing
            Set FSO = Nothing
        End Sub

The problem I have is that to save the file, the user has to view it, then save it.

Could someone perhaps provide some guidance on how I may be able to change this so that instead of opening the file, the link takes the user straight to the 'Save As Dialog' .

Many thanks and kind regards

Chris
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,213,536
Messages
6,114,215
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top