Results 1 to 11 of 11

Thread: Solved: .Application.Visible = False

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #10
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    If I am understanding correctly, you want to change this specific workbook's visibility. If that is correct, maybe try the workbook's IsAddin property.

    Not well thought through, but as a start, something like:

    In the Userform's module:
    [vba]Option Explicit

    Private Sub cmdUnload_Click()
    Unload Me
    End Sub

    'vbFormControlMenu 0 The user has chosen the Close command from the Control menu on the UserForm.
    'vbFormCode 1 The Unload statement is invoked from code.
    'vbAppWindows 2 The current Windows operating environment session is ending.
    'vbAppTaskManager 3 The Windows Task Manager is closing the application.
    Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
    Dim bWasSaved As Boolean

    If CloseMode <= vbFormCode Then
    bWasSaved = ThisWorkbook.Saved
    ThisWorkbook.IsAddin = False
    ThisWorkbook.Saved = bWasSaved
    End If
    End Sub[/vba]

    In the ThisWorkbook Module:
    [vba]Option Explicit

    Private Sub Workbook_Open()
    ThisWorkbook.IsAddin = True
    ThisWorkbook.Saved = True
    frmMyForm.Show vbModal
    End Sub[/vba]

    Hope that helps,

    Mark
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •