File dialog makes application visible

  • Thread starter Thread starter CG Rosen
  • Start date Start date
C

CG Rosen

Good day Group,

When opening the Workbook follwing is stated:

Application visible =false
Userform1.show

From a Comandbutton on the Userform the code below executes.

When clicking the OK button or the Cancel button in the file dialog the
Excel sheet
becomes visible.

Looking for hints how to keep the Excel application non visible all the
time,

Brgds CG Rosen

--------------------------------------------------------------------------------

Dim fd As FileDialog
Dim strPath As String
Dim B As Integer
Dim IncludeSubfolders As Boolean
Set fd = Application.FileDialog(msoFileDialogFolderPicker)
Dim selFldr As Variant

With fd
If .Show = -1 Then
For Each selFldr In .SelectedItems
strPath = selFldr & "\"
Next selFldr
Else
Exit Sub
End If
End With
IncludeSubfolders = False
B = MsgBox("Include Subfolders?", vbYesNo, "Scope")
If B = 6 Then
IncludeSubfolders = True
Else
IncludeSubfolders = False
End If

more code
 
try the following...

sub nameofsub

Application.ScreenUpdating = False

other code

Application.ScreenUpdating = True

end sub


good luck....
 
sorry... should have read the whole mail..

Dim fd As FileDialog
Dim strPath As String
Dim B As Integer
Dim IncludeSubfolders As Boolean
Set fd = Application.FileDialog(msoFileDialogFolderPicker)
Dim selFldr As Variant
--------------------------
Application.ScreenUpdating = False

With fd
If .Show = -1 Then
For Each selFldr In .SelectedItems
strPath = selFldr & "\"
Next selFldr
Else
Exit Sub
End If
End With
IncludeSubfolders = False
B = MsgBox("Include Subfolders?", vbYesNo, "Scope")
If B = 6 Then
IncludeSubfolders = True
Else
IncludeSubfolders = False
End If

more code

-------------------------------------
Application.ScreenUpdating = True

end sub

This allows "forms" to be opened and closed, but the excel sheets stay
"static' i.e. unopened
 
Back
Top