none
I need Help I lost de Rigth Click Over de Sheet Tab, RRS feed

  • Pregunta

  • I need Help with this problem, I am Test a this code in one Module

    '_________________________________________________________________________

    Option Explicit
    Private Declare Function SetActiveWindow Lib "user32" (ByVal hWnd As Long) As Long
    Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
    Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
    Private Const WS_MAXIMIZEBOX = &H10000
    Private Const WS_MINIMIZEBOX = &H20000
    Private Const GWL_STYLE = (-16)
    Private Const SW_SHOWMAXIMIZED = 3
    Private Const SW_SHOWNORMAL = 1
    Private Const SW_SHOWMINIMIZED = 2
    Private Const WS_THICKFRAME = &H40000

    Dim hWnd As Long
    Dim IStyle As Long

    Public canClose As Boolean

    Sub app_Initialize()
      hWnd = Application.hWnd
      IStyle = GetWindowLong(hWnd, GWL_STYLE)
      IStyle = IStyle Or WS_THICKFRAME
      IStyle = IStyle And Not WS_MINIMIZEBOX
      IStyle = IStyle And Not WS_MAXIMIZEBOX
      SetWindowLong hWnd, GWL_STYLE, IStyle
    End Sub


    Sub reSet()
      With Application
        .ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",true)"
        .CommandBars("Status Bar").Visible = True
        .DisplayFormulaBar = True
        .DisplayScrollBars = True
        .Caption = Empty
        .ActiveWindow.Caption = False
        .ActiveWindow.DisplayHeadings = True
        .ActiveWindow.DisplayWorkbookTabs = True
        .WindowState = xlNormal
      End With
      app_Reset
      canClose = True
    End Sub


    Private Sub app_Reset()
      hWnd = Application.hWnd
      IStyle = GetWindowLong(hWnd, GWL_STYLE)
      IStyle = IStyle Or WS_THICKFRAME
      IStyle = IStyle Or WS_MINIMIZEBOX
      IStyle = IStyle Or WS_MAXIMIZEBOX
      SetWindowLong hWnd, GWL_STYLE, IStyle
    End Sub

    '_________________________________________________________________________________

    But when test uno time I lost de Rigth Click Over de Sheet Tab,

    I Lost The tab have a name of the sheet, and Rigth Click Hide or Show the Sheet

    And the problem is, I lost in old new Workbook

     

    Please Help me

    Thanks


    Edchar
    domingo, 6 de noviembre de 2011 22:28