ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¤u§@ªí¯Á¤Þ¼ÐÅÒ VB°ÝÃD

[µo°Ý] ¤u§@ªí¯Á¤Þ¼ÐÅÒ VB°ÝÃD

½Ð°Ý ¡y¤u§@ªí¯Á¤Þ¼ÐÅÒ¡z ¥ÎVBµ{¦¡³]©w¤£Åã¥Ü(Ãö³¬)¤u§@ªí¯Á¤Þ¼ÐÅÒ ,
­Y­nÅã¥Ü¤u§@ªí¯Á¤Þ¼ÐÅÒ®É, ¨ä¥L¤H­ûµLªk±q EXCEL¿ï¶µ¤¤¤Ä¿ï ¡yÅã¥Ü¤u§@ªí¯Á¤Þ¼ÐÅÒ¡z( ¦p¤U¹Ï½d¨Ò )
¥u¯à¦³ºÞ²zªÌÅv­­( ¿é¤J±K½X) ¤~¯à¶}±Ò¡y¤u§@ªí¯Á¤Þ¼ÐÅÒ¡z , ½Ð¦U¦ìVB«e½ú°ª¤â¨ó§U­n¦p¦ó¼g ~

    ActiveWindow.DisplayWorkbookTabs = False ( Ãö³¬)
    ActiveWindow.DisplayWorkbookTabs = True  (¶}±Ò)

[attach]37378[/attach]

TOP

¦^´_ 1# lkkchf


    ÁÂÁ«e½úµoªí¦¹¥DÃD
VBµ{¦¡³]©w¤£Åã¥Ü(Ãö³¬)¤u§@ªí¯Á¤Þ¼ÐÅҥتº¬°¦ó?
¦pªG¬O¬°¤F¤£Åý¨Ï¥ÎªÌÅÜ´«¤u§@ªí,¥i¥H(ÁôÂèä¥L¤u§@ªí+«OÅ@¬¡­¶Ã¯)©Î³\¥i¥H¦³¬Û¦üªº®ÄªG
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 3# Andy2483


   A¤j±z¦n ,  ¨Ï¥ÎVBµ{¦¡¥D­n¬O¤u§@¤W¥i¨Ï¥Î¥¨¶°«ö¶s§Ö³t¤Á´«¬O§_Åã¥Ü¤u§@ªí¯Á¤Þ¼ÐÅÒ ,  ¦ý¥u­­ºÞ²zªÌ¦³Åv­­(¿é¤J±K½X) ¥iÅã¥Ü¦³­þ¨Ç¤u§@ªí  , ÁٽЫe½ú«üÂI ·P®¦

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2024-1-30 16:17 ½s¿è

¦^´_ 4# lkkchf


    ÁÂÁ«e½ú¦^´_,¥H¤U´À¥N¤è®×½Ð¸Õ¸Õ¬Ý  (­­ºÞ²zªÌ¦³Åv­­(¿é¤J±K½X)ªº»Ý¨D: ¥H ¨ú®ø«OÅ@¬¡­¶Ã¯ªº¿é¤J±K½X§@ºÞ±±)
PS:«á¾Ç¤]·Qª¾¹D¤°»ò¥N½X¥i¥H±±¨î ¿ï¶µ>>¶i¶¥¿ï¶µ ¤£Åý¨Ï¥ÎªÌ§ïÅÜ

Sub ¤£Åã¥Ü_¤u§@ªí¯Á¤Þ¼ÐÅÒ()
Dim xS As Worksheet
If ActiveWorkbook.ProtectWindows Or ActiveWorkbook.ProtectStructure Then Exit Sub
For Each xS In Worksheets
   If Not xS Is ActiveSheet Then xS.Visible = False
Next
ActiveWorkbook.Protect "0000", Structure:=True, Windows:=True
ActiveWindow.DisplayWorkbookTabs = False
End Sub

Sub Åã¥Ü_¤u§@ªí¯Á¤Þ¼ÐÅÒ()
Dim xS As Worksheet, acS As Worksheet
If ActiveWorkbook.ProtectWindows Or ActiveWorkbook.ProtectStructure Then
   MsgBox "½Ð¥ý¨ú®ø«OÅ@¬¡­¶Ã¯!": Exit Sub
End If
Set acS = ActiveSheet
For Each xS In Worksheets
   xS.Visible = True
Next
acS.Activate
ActiveWindow.DisplayWorkbookTabs = True
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 5# Andy2483


­è´ú¸Õ¤£Åã¥Ü_¤u§@ªí¯Á¤Þ¼ÐÅÒ«á, ¤´¥i±qEXCEL¿ï¶µ¤¤¤]¤Ä¿ï ¡yÅã¥Ü¤u§@ªí¯Á¤Þ¼ÐÅÒ¡z
¨Ï¥ÎVBµ{¦¡§Æ±æ³]©wºÞ²zªÌÅv­­±K½X«á,
±qEXCEL¿ï¶µ¤¤¤]µLªk¤Ä¿ï¡yÅã¥Ü¤u§@ªí¯Á¤Þ¼ÐÅÒ¡z
¥HÁקK¨ä¥L¤H­û¶}±Ò¤u§@ªí¯Á¤Þ¼ÐÅÒ (¥u¦³ºÞ²zªÌ±K½X¤~¥i)
¥t¥~¦b°õ¦æ¥¨¶°«ö¶s®É¥u¦³1­Ó
¨Ò¦p: °õ¦æµ{¦¡®É·|¶}µ¡¸ß°Ý  ¡y¬O§_Åã¥Ü¤u§@ªí¯Á¤Þ¼ÐÅÒ ? ¡z
·íÂI¿ï ¬O(Y)  --> ¿é¤J±K½X½T»{µL»~«á -->Åã¥Ü¤u§@ªí¯Á¤Þ¼ÐÅÒ
·íÂI¿ï §_(N)  --> ¿é¤J±K½X½T»{µL»~«á -->ÁôÂäu§@ªí¯Á¤Þ¼ÐÅÒ

TOP

¦^´_ 5# Andy2483

«e­±°ÝÃD¥i¯à±Ô­z»¡©ú©Îªí¹F®É¤£¬O«Ü©ú½T , ¯÷ºI¹Ï»¡©ú¦p¤U´£¨Ñ µ¹¤j®v±z°Ñ¦Ò ~

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2024-1-31 10:18 ½s¿è

¦^´_ 7# lkkchf


    ÁÂÁ½׾Â,ÁÂÁ«e½ú¦A¦^´_,¤@°_¾Ç²ß
«á¾ÇÂǦ¹©«¾Ç²ß¨ì«Ü¦hª¾ÃÑ,¾Ç²ß¤è®×¦p¤U,½Ð«e½ú°Ñ¦Ò


Option Explicit
#If Win64 Then
   Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr
   Private Declare PtrSafe Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As LongPtr, ByVal hWnd2 As LongPtr, ByVal lpsz1 As String, ByVal lpsz2 As String) As LongPtr
   Private Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As LongPtr, ByVal wMsg As Long, ByVal wParam As LongPtr, lParam As Any) As LongPtr
   Private Declare PtrSafe Function timeSetEvent Lib "winmm.dll" (ByVal uDelay As Long, ByVal uResolution As Long, ByVal lpFunction As LongPtr, ByVal dwUser As LongPtr, ByVal uFlags As Long) As Long
   Private Declare PtrSafe Function timeKillEvent Lib "winmm.dll" (ByVal uID As Long) As Long
   #Else
   Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
   Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
   Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
   Private Declare Function timeSetEvent Lib "winmm.dll" (ByVal uDelay As Long, ByVal uResolution As Long, ByVal lpFunction As Long, ByVal dwUser As Long, ByVal uFlags As Long) As Long
   Private Declare Function timeKillEvent Lib "winmm.dll" (ByVal uID As Long) As Long
#End If
Private Const Em_SetPassWordChar = &HCC
Dim lTimeID As Long
Const pswdInputBoxTitle = "pswdInputBox"
Sub TimeProc(ByVal uID As Long, ByVal uMsg As Long, ByVal dwUser As Long, ByVal dw1 As Long, ByVal dw2 As Long)
Dim hwd As LongPtr
hwd = FindWindow("#32770", pswdInputBoxTitle)
If hwd <> 0 Then hwd = FindWindowEx(hwd, 0, "Edit", vbNullString): SendMessage hwd, Em_SetPassWordChar, 42, 0:  timeKillEvent lTimeID
End Sub
Function pswdInputBox() As Variant
lTimeID = timeSetEvent(10, 50, AddressOf TimeProc, 1, 1)
pswdInputBox = InputBox(Prompt:="½Ð¿é¤JºÞ²z­û±K½X", Title:=pswdInputBoxTitle)
End Function
'=========================================================
Sub ¤u§@ªí¯Á¤Þ¼ÐÅÒ_S_H()
Dim xS As Worksheet, acS As Worksheet
If ActiveWorkbook.ProtectWindows Or ActiveWorkbook.ProtectStructure Then
   If pswdInputBox <> "12345" Then Exit Sub
   ActiveWorkbook.Unprotect "0000"
   Set acS = ActiveSheet
   For Each xS In Worksheets: xS.Visible = True: Next
   acS.Activate: ActiveWindow.DisplayWorkbookTabs = True: Exit Sub
End If
For Each xS In Worksheets: xS.Visible = IIf(Not xS Is ActiveSheet, False, True): Next
ActiveWorkbook.Protect "0000", Structure:=True, Windows:=True
ActiveWindow.DisplayWorkbookTabs = False
End Sub
'=========================================================
Sub Åã¥Ü_¤u§@ªí1()
Dim xS As Worksheet, acS As Worksheet
ActiveWorkbook.Unprotect "0000": Set acS = Sheets("¤u§@ªí1"): acS.Visible = True: acS.Activate
For Each xS In Worksheets: xS.Visible = IIf(Not xS Is acS, False, True): Next
ActiveWorkbook.Protect "0000", Structure:=True, Windows:=True: ActiveWindow.DisplayWorkbookTabs = False
End Sub
'=========================================================
Sub Åã¥Ü_¤u§@ªí2()
Dim xS As Worksheet, acS As Worksheet
ActiveWorkbook.Unprotect "0000": Set acS = Sheets("¤u§@ªí2"): acS.Visible = True: acS.Activate
For Each xS In Worksheets: xS.Visible = IIf(Not xS Is acS, False, True): Next
ActiveWorkbook.Protect "0000", Structure:=True, Windows:=True: ActiveWindow.DisplayWorkbookTabs = False
End Sub
'=========================================================
Sub Åã¥Ü_¤u§@ªí3()
Dim xS As Worksheet, acS As Worksheet
ActiveWorkbook.Unprotect "0000": Set acS = Sheets("¤u§@ªí3"): acS.Visible = True: acS.Activate
For Each xS In Worksheets: xS.Visible = IIf(Not xS Is acS, False, True): Next
ActiveWorkbook.Protect "0000", Structure:=True, Windows:=True: ActiveWindow.DisplayWorkbookTabs = False
End Sub
°Ñ¦Ò:
https://forum.twbts.com/viewthre ... amp;page=1#pid29595
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 8# Andy2483

¨¯­W±z¤F~ ¥i§_´£¨Ñ±zªºEXCELÀÉ®× Åý¾Ç¥Í¾Ç²ß±z¼g±oVBµ{¦¡½d¨Ò~ ·P®¦

TOP

¦^´_ 9# lkkchf
20240131.zip (28.19 KB)
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

        ÀR«ä¦Û¦b : Ãø¦æ¯à¦æ¡AÃø±Ë¯à±Ë¡AÃø¬°¯à¬°¡A¤~¯àª@µØ¦Û§Úªº¤H®æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD