Please Write the following program on VBA: Read the name, customer number and te
ID: 3694072 • Letter: P
Question
Please Write the following program on VBA: Read the name, customer number and telephone number of customers. All these are string. The length of the name is 25, of the customer number is 8, and telephone is 13. The format is Name: (Example: Davis, Paul) Phone: dddddddddd (Example: 7878881234) Customer No: dddddd (Example: 123456) After reading customer number, add the characters DS at the beginning. It must be converted to DSdddddd. (Example: DS123456) The telephone number must be converted to (ddd)ddddddd. (Example: (787)888-1234) The final result will be displayed as Customer Name: ************, ************ (there is a space after comma) Customer Number: ******** (a total of 8 characters) Customer Phone Number: (***)******* (a total of 13 characters) Every sub and function must have a heading. The main sub must have a heading that includes the name of the author, a description of the entire program and the date. In addition, each function's heading must include the exact description of the task the function performs and the list of input and output data. Remark. Use pencil, no pen. Write clearly and sequentially in one column. Your program must look exactly as if it was written on the computer. Use comment sign to state when you need to state what your next statement will perform.Explanation / Answer
Dim Cname as String
Dim Cname as String
Dime Phone as String
cname=InputBox("Enter Customer name")
Cnumber=InputBox("Enter Customer number")
Cphone=InputBox("Enter phone number")
if Len(cname)=25 and Len(cnumber)=8 and Len(CPhone)=14
then
cnumber="DS"&cnumber;
k=Instr(cname,' ')
Debug.Print "Customer Name:"&left(cname,k)&","right(cname,k)
Debug.Print "Customer Number:"&cnumber
Debug.print "Customer Phone:("&left(Cphone,4)&")"&left(CPhone,4,7)&"-"right(Cphone,7)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.