I've been trying (fruitlessly) to solve this problem. Back in the day, I was able to do this quite easily in Access, but I have committed to move everything to A5 and can't get this to work.
In the detail view of a customer grid, I want a button that will trigger the following function. I would like the button to open an Excel file and populate certain cells with customer data. The estimator can then use the excel file to complete an onsite estimation. He would then be able to save the file and upload it back. But, alas, I can't even get the first part done. Can anyone please tell me where I'm messing up or steer me in the right direction?
In the detail view of a customer grid, I want a button that will trigger the following function. I would like the button to open an Excel file and populate certain cells with customer data. The estimator can then use the excel file to complete an onsite estimation. He would then be able to save the file and upload it back. But, alas, I can't even get the first part done. Can anyone please tell me where I'm messing up or steer me in the right direction?
Code:
FUNCTION Interior AS F ( ) dim MyExcel as P dim MyWorkbook as P dim Mywoorkbook1 as P dim MyRange as P dim fn as C dim LName as C dim FName as C dim Email as C dim HomePhone as C dim Address1 as C dim City as C dim WorkPhone as C dim Zip as C dim Referral as C LName= e._currentRowDataNew.Lastname FName=e._currentRowDataNew.Firstname Email=e._currentRowDataNew.Email HomePhone=e._currentRowDataNew.Hmphone Address1=e._currentRowDataNew.Address1 City=e._currentRowDataNew.City WorkPhone=e._currentRowDataNew.Workphone Zip=e._currentRowDataNew.Zip Referral=e._currentRowDataNew.Referral fn = "interior.xlsx" MyWorkbook = ole.GetObject(fn) MyWorksheet1 = MyWorkbook.Worksheets(1) MyRange = MyWorksheet1.Range("A10") MyRange.value = (LName+", "+FName) MyRange = MyWorksheet1.Range("F10") MyRange.value = Email MyRange=MyWorksheet1.Range("I10") MyRange.value = HomePhone MyRange=MyWorksheet1.Range("A12") MyRange.value = Address1 MyRange = MyWorksheet1.Range("L12") MyRange.value = City MyRange = MyWorksheet1.Range("N10") MyRange.value = WorkPhone MyRange = MyWorksheet1.Range ("R12") MyRange.value = Zip MyRange = MyWorksheet1.Range ("U12") MyRange.value = Date() MyRange = MyWorksheet1.Range ("D13") MyRange.value = Referral MyWorkbook.Application.visible = .T. MyWorkbook.windows(1).activate() END FUNCTION
Comment