Is it possible to insert a value into a cell in Excel which is dependant on a field value within an Access table?
If possible, I would like code for this to be placed in a control button on a Access Form.
Any help much appreciated.
Try putting something like this in your button's click event. I grabbed this from an application I made, and changed a few things so it would make sense. Change the names of things as you like.
Code:
Dim StatusSheet As New Excel.Workbook
Set StatusSheet = GetObject("c:\sheets\MySheet.xls")
StatusSheet.Sheets(1).Cells(2, 2)="MyVal"
StatusSheet.Save
StatusSheet.Close
I cut a bunch of stuff out and gave you just the basics. This should work. Note that Cells(x,y) gives you row,col references which is backward from the usual "C5" reference.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.