Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub CommandButton1_Click()
- Dim fd As Office.FileDialog
- z1 = UserForm2.Label1.Caption // Data from the Excel Sheet
- z2 = UserForm2.Label2.Caption
- z3 = UserForm2.Label3.Caption
- z4 = UserForm2.Label4.Caption
- z5 = UserForm2.Label5.Caption
- z6 = UserForm2.Label6.Caption
- Set fd = Application.FileDialog(msoFileDialogFilePicker)
- With fd
- .AllowMultiSelect = False
- .Filters.Add "All", "*.*"
- If .Show = True Then
- txtFileName = .SelectedItems(1)
- Open txtFileName For Output As #1
- Print #1, z6
- Print #1, '
- Print #1, "Ex1 = "; z1
- Print #1, '
- Print #1, "Ex2 = "; z2
- Print #1, '
- Print #1, "Ex3 = "; z3
- Print #1, '
- Print #1, "Ex4 = "; z4
- Print #1, '
- Print #1, "Ex5 = "; z5
- MsgBox "The data has been exported"
- Close #1
- UserForm2.Hide
- UserForm1.Hide
- End If
- End With
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement