Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub runConvertnoDialog()
- Dim f As Object
- Set f = Application.FileDialog(3)
- f.AllowMultiSelect = True
- If f.Show Then
- For i = 1 To f.SelectedItems.Count
- ConvertnoDialog (f.SelectedItems(i))
- Next
- End If
- End Sub
- Sub ConvertnoDialog(f As Variant)
- Dim SummarySheet As Worksheet
- ' Create a new workbook and set a variable to the first sheet.
- Set SummarySheet = Workbooks.Add(xlWBATWorksheet).Worksheets(1)
- Dim srcWorkbook As Workbook
- Dim n As Integer
- n = 0
- 'loops through each file performing the indicated operations
- sfile = Filename(f, spath)
- Set srcWorkbook = Workbooks.Open(spath & sfile)
- Set sht = srcWorkbook.Worksheets(1)
- 'there's a lot more 'converting' to be done, but this is some of it
- sht.Range("A19:R90").Copy
- SummarySheet.Range("A2").PasteSpecial
- SummarySheet.SaveAs (spath & "Converted " & sfile)
- SummarySheet.Close
- sht.Close
- End Sub
- 'provides the file name and path: https://stackoverflow.com/questions/14915179/ms-access-browse-for-file-and-get-file-name-and-path
- Public Function Filename(ByVal strPath As String, spath) As String
- spath = Left(strPath, InStrRev(strPath, "\"))
- Filename = Mid(strPath, InStrRev(strPath, "\") + 1)
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement