加入 Common Dialog 的控件 , 成功加入後出現紅框的 Icon 表示成功 Microsoft Common Dialog Control 6.0 Control Object of Form 先在 Form 上建立 CommonDialog 的控件 , 如未建立使用控件會跳出 Variable not defined. Button 呼叫 CommonDialog, 顯示 FileDialog Private Sub CTL_BTN_SEL_FILE_Click() With CommonDialog1 .DialogTitle = "Select the Report File" .Filter = "Custom Format (*.xls)|*.xls" .Flags = .Flags + cdlOFNHideReadOnly .InitDir = specialPath("Desktop") .ShowOpen CTL_BTN_SEL_FILE.Caption = .fileName End With End Sub Property DialogTitle As String 設定 Dialog 的 Title Property Filter As String 設定檔案類型 https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-basic-6/aa238813(v=vs.60) Property Flags As Long 設定屬性 https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-basic-6/aa238842(v=vs.60) Property InitDir As String 設定初始位置 Sub ShowOpen () 顯示 File Dia...
留言
張貼留言