Private Sub Workbook_Open()
Workbooks.Open Filename:="P:\Downloads\PRICEPACKS\Excel Stuff\pw.xls" 'Opens pw.xls for password
Dim name As String
name = Environ("username") 'Gets username of person using sheet
Dim dateform As String
dateform = Sheets("USER DETAILS").[B24] 'Gets formula for todays date
Dim nameform
nameform = Sheets("USER DETAILS").[B25] 'Gets formula to work out users real name
'Input box for Company Name, if nothing entered it loops
Dim go_on1 As Boolean, mycount1 As String
go_on1 = False
Do While go_on1 = False
Dim Company_Name As String
Company_Name = InputBox("Please type in the Company Name", "Company Name")
If Company_Name = "" Then
Call Beeper1
Beep
MsgBox "You did not enter a company name! Please try again!"
Else: go_on1 = True
Sheets("DETAILS ENTRY").[c1] = Company_Name
End If
Loop
'Input box for Town
Dim Town As String
Town = InputBox("Please type in the Company's Town/City if it is needed.", "Area")
Sheets("DETAILS ENTRY").[c4] = Town
'Input box for Your Name
Dim Your_Name As String
Your_Name = InputBox("Your name is automatically put on the pricepack, if you wish to change the name then please input it here.", "Your Name")
If Your_Name = "" Then
Sheets("USER DETAILS").[B1] = name
Sheets("DETAILS ENTRY").[c8] = nameform
Else
Sheets("DETAILS ENTRY").[c8] = Your_Name
End If
'Input box for Pricelist date
Dim Da_te As String
Da_te = InputBox("What date do you want on this pricepack?", "Date")
If Da_te = "" Then
Sheets("DETAILS ENTRY").[k8] = dateform
Else
Sheets("DETAILS ENTRY").[k8] = Da_te
End If
'Input box for the customers Sales Rep
Dim Sales_Rep As String
Sales_Rep = InputBox("Please type in the Sales Reps name.", "Sales Representative")
Sheets("DETAILS ENTRY").[k1] = Sales_Rep
'Input box for Sales Reps tel. no.
Dim Sales_Rep_Tel As String
Sales_Rep_Tel = InputBox("Please type in the Sales Reps telephone number.", "Sales Representative Telephone Number")
Sheets("DETAILS ENTRY").[k4] = Sales_Rep_Tel
'Input box for Account Number, if nothing entered it loops
Dim go_on2 As Boolean, mycount2 As String
go_on2 = False
Do While go_on2 = False
Dim Account_number As String
Account_number = InputBox("Please type in the Customers Account Number or buying group.", "Customer Account Number/Buying Group")
If Account_number = "" Then
Call Beeper1
Beep
MsgBox "You did not enter an account number or buying group! Please try again!"
Else: go_on2 = True
Sheets("DETAILS ENTRY").[k10] = Account_number
End If
Loop
'Input box to check if the company is based in Europe or the UK
Dim Euro As String
Euro = InputBox("Does this company deal with us in Euros?", "Euros?")
Sheets("DETAILS ENTRY").[C6] = Euro
'Input box for Euro exchange rate
Dim Exchange As String
Exchange = InputBox("Please type in the Euro Exchange Rate.", "Exchange Rate")
Sheets("DETAILS ENTRY").[k6] = Exchange
Application.Calculate
Call Pricepack
End Sub