Option Explicit
Private CD As CommonDialog
Private Sub Command1_Click()
CD.DialogTitle = "Välj fil att öppna"
CD.ShowOpen
MsgBox CD.FileName
End Sub
Private Sub Command2_Click()
CD.DialogTitle = "spara som"
CD.ShowSave
MsgBox CD.FileName
End Sub
Private Sub Command3_Click()
MsgBox CD.GetFolderName("Välj Folder")
End Sub
Private Sub Form_Load()
Set CD = New CommonDialog
With CD
.InitDir = "c:\"
.Filter = "Alla Filer (*.*)|*.*|Text Filer (*.txt)|*.txt"
End With
Command1.Caption = "Öppna"
Command2.Caption = "Spara"
Command3.Caption = "Folder"
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Set CD = Nothing
End Sub