返回列表 上一主題 發帖

[發問] 為何各sheets 被隱藏了

[發問] 為何各sheets 被隱藏了

請教大大:
        晚學有問題三,敬請賜教
一.VBA如何下與法,使A1.xls內的所有sheets隱藏
   且取消隱藏 需password
二.奇怪   個人學淺   找不出原因
Application.Visible=False
FileName = ThisWorkbook.Path & "\資料庫\" & str1 & "學期資料.xls"
If fsobj.FileExists(FileName) Then
        With CreateObject(FileName)
            .Sheets(SHname).Cells.Copy wb.Sheets("Temp").Cells(1, 1)
            .Close True
        End With
End If
當 application.quit 後 ,FileName之各sheets  沒有被隱藏

Application.Visible=False
FileName = ThisWorkbook.Path & "\資料庫\" & str1 & "學期資料.xls"
If fsobj.FileExists(FileName) Then
        With CreateObject(FileName)
           wb.Sheets("Temp").Cells.Copy  .Sheets(SHname).Cells(1, 1)
            .Close True
        End With
End If
當 application.quit 後 ,FileName之各sheets  被隱藏了  
應如何使它不隱藏  再.Close True
三.如何使A1.xls打開時不顯示功能列(*也就是說事前就已經設定好)
     VBA如何在B1.xls事前對A1.xls作事前設定

謝謝

回復 2# GBKEE
謝謝版大
Sheet1.Visible = xlSheetVeryHidden   與
Sheet1.Visible = false      一樣嗎?

Sub Ex()
    Dim FileName As String, E As Workbook
    FileName = ThisWorkbook.Path & "\資料庫\" & "97學年上學期資料.xls"
    xlfilenam = Dir(FileName)
    Dim fsobj As Object
    Set fsobj = CreateObject("Scripting.FileSystemObject")
    If fsobj.FileExists(FileName) Then
        With CreateObject(FileName)
              .Windows(xlfilenam).Visible = False ---------此行可否加密
             .Close True
        End With
    End If

TOP

回復 2# GBKEE
再請教GBKEE版大
這是自訂表單  已密碼控制流程
  Private Sub CommandButton1_Click()
    If Label1.Caption = "" Or Label1.Caption = "0" Then
        Unload Me
        Exit Sub
    End If
    If Label1.Caption = "510510" Then
        Sheets("首頁").Cells(5, 12) = Label1.Caption
        Unload Me
    Else
        TextBox1 = ""
        TextBox1.SetFocus
    End If

End Sub
Private Sub TextBox1_Change()
    If TextBox1 = "" Then
        Label1.Caption = TextBox1
        Exit Sub
    End If
    If Right(TextBox1, 1) <> "*" Then
        Label1.Caption = Label1.Caption & Right(TextBox1, 1)
    End If
    an = Len(TextBox1)
    TextBox1 = String(an, "*")
End Sub  
請教版大:
我的CommandButton1.caption 是"確定"
當TextBox1輸入了密碼好了    按  "確定"鍵 即可
     個人想不移動滑鼠  直接按  keyboard上"Enter"鍵  即可觸發  CommandButton1_Click
     應如何下語法

TOP

回復 5# GBKEE
謝謝GBKEE
請教
取消 如 右邊的隱藏  Sheet1.Visible = xlSheetVeryHidden   
用 Sheet1.Visible = True      可有其他知受限?

TOP

        靜思自在 : 是非當教育,讚美作警惕。
返回列表 上一主題