Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '-----Workbook A-----'
- Option Explicit
- Private Sub Workbook_Open()
- Application.Visible = False
- ThisWorkbook.Activate
- Dim wb As Workbook
- For Each wb In Workbooks
- If wb.Name = "WorkbookB.xlsm" Then
- wb.Close xlDoNotSaveChanges
- End If
- Next wb
- Call UserForm1.Show
- End Sub
- '-----Userform1-----'
- Option Explicit
- Private Sub CommandButton1_Click()
- Application.Visible = True
- UserForm1.Hide
- End Sub
- Private Sub CommandButton2_Click()
- TextBox1.Value = Sheets("SheetA").Range("A1")
- End Sub
- Private Sub UserForm_Initialize()
- Application.Visible = False
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement