infinity
11-04-2005, 07:18 PM
Hi all you coding pros
I am trying to use an input box to enter a name and address on a different sheet within the workbook if the response to the MsgBox = vbYes. At the point in the code where it says
Sheets("ENVELOPE").Activate
Range("F13:K19").Select
I would actually like to put the address into a text box if possible. Could someone look at my code and offer any suggestions? Thank you so much!
Dim Msg, Style, Title, Response, MyString
Msg = "Would you like to print an envelope with this letter?"
Style = vbYesNo + vbQuestion + vbDefaultButton1
Title = "PRINT DONATION LETTER"
Response = MsgBox(["Would you like to print an envelope with this letter?"], vbYesNo + vbQuestion + vbDefaultButton1, ["PRINT DONATION LETTER"])
MyString = "Yes" + "No"
If Response = vbYes Then
Sheets("ENVELOPE").Activate
Range("F13:K19").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("ENVELOPE").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveWorkbook.Protect Structure:=True, Windows:=False
Sheets("DONATION LETTER").Activate
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveWorkbook.Protect Structure:=True, Windows:=False
Range("A1").Select
ElseIf Response = vbNo Then
Sheets("DONATION LETTER").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveWorkbook.Protect Structure:=True, Windows:=False
Range("A1").Select
End If
I am trying to use an input box to enter a name and address on a different sheet within the workbook if the response to the MsgBox = vbYes. At the point in the code where it says
Sheets("ENVELOPE").Activate
Range("F13:K19").Select
I would actually like to put the address into a text box if possible. Could someone look at my code and offer any suggestions? Thank you so much!
Dim Msg, Style, Title, Response, MyString
Msg = "Would you like to print an envelope with this letter?"
Style = vbYesNo + vbQuestion + vbDefaultButton1
Title = "PRINT DONATION LETTER"
Response = MsgBox(["Would you like to print an envelope with this letter?"], vbYesNo + vbQuestion + vbDefaultButton1, ["PRINT DONATION LETTER"])
MyString = "Yes" + "No"
If Response = vbYes Then
Sheets("ENVELOPE").Activate
Range("F13:K19").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("ENVELOPE").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveWorkbook.Protect Structure:=True, Windows:=False
Sheets("DONATION LETTER").Activate
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveWorkbook.Protect Structure:=True, Windows:=False
Range("A1").Select
ElseIf Response = vbNo Then
Sheets("DONATION LETTER").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveWorkbook.Protect Structure:=True, Windows:=False
Range("A1").Select
End If