File dialog makes application visible

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
 
L

Les Gombart

try the following...

sub nameofsub

Application.ScreenUpdating = False

other code

Application.ScreenUpdating = True

end sub


good luck....
 
L

Les Gombart

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top