When is a Dim statement processed in the compiling of VBA code? Is there any efficiency gain if I do this?:
Dim oFileDiag As FileDialog
Set oFileDiag = Application.FileDialog(msoFileDialogFilePicker)
If oFileDiag.Show = -1 Then
'// Dim statement further down in the code...
Dim ofdSelected As FileDialogSelectedItems
Set ofdSelected = .SelectedItems
End If
As opposed to this?:
'// Dim statement at the beginning of the code...
Dim oFileDiag As FileDialog
Dim ofdSelected As FileDialogSelectedItems
Set oFileDiag = Application.FileDialog(msoFileDialogFilePicker)
If oFileDiag.Show = -1 Then
Set ofdSelected = .SelectedItems
End If