Paul Sansom
Board Regular
- Joined
- Jan 28, 2013
- Messages
- 178
- Office Version
- 2021
- 2016
- Platform
- Windows
Hi
Any guidance on why Line 1 (Application.) works when used in isolation but not in my test sub.
Objective - Clear the Immediate window each time i run test during development?
Cheers Paul
Any guidance on why Line 1 (Application.) works when used in isolation but not in my test sub.
Objective - Clear the Immediate window each time i run test during development?
Cheers Paul
Code:
Sub Test()
Application.SendKeys "^g ^a {DEL}"
Dim fDialog As FileDialog, result As Integer
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
'IMPORTANT!
fDialog.AllowMultiSelect = True
'Optional FileDialog properties
fDialog.Title = "Select a file"
fDialog.InitialFileName = "C:\Users\Paul\Pictures\Captures"
'Optional: Add filters
fDialog.Filters.Clear
'fDialog.Filters.Add "Excel files", "*.xlsx"
'fDialog.Filters.Add "All files", "*.*"
'Show the dialog. -1 means success!
If fDialog.Show = -1 Then
For Each file In fDialog.SelectedItems
fn = fn + 1
fn = Format(fn, "0000")
extFind = Right$(file, Len(file) - InStrRev(file, "."))
filesavename = Sheet9.Range("N64") & fn & " ." & extFind
'Debug.Print file
Debug.Print filesavename
Next file
End If
End Sub