Les Isaacs
Registered User.
- Local time
- Today, 08:12
- Joined
- May 6, 2008
- Messages
- 186
Hi All
I have a form with a button whose event procedure currently copies a certain excel spreadsheet to a known path and file name, and then it opens the spreadsheet. The user then enters 5 values into 5 specific cells (always the same cells), then closes the spreadsheet, then clicks a second button that emails the spreadsheet to a recipient.
This all works fine, but it would be much better if the first procedure could assign the 5 values automatically to the 5 cells: the values are all available from the form that is currently open (and which has the two buttons). So in plain language I need something like:
copy the spreadsheet to the specified path and filename
open the spreadsheet
set spreadsheet cell D:13 to [forms]![frm mydata]![txtCode]
set spreadsheet cell T:22 to [forms]![frm mydata]![txtName]
set spreadsheet cell V:2 to [forms]![frm mydata]![txtCategory]
set spreadsheet cell W:42 to [forms]![frm mydata]![txtSerial]
set spreadsheet cell V:22 to [forms]![frm mydata]![txtStartDate]
Save and Close spreadsheet
Email spreadsheet
All the above is currently being done except the 5 'Set' lines! I'm sure this isn't too difficult, but despite googling it at length I can't seem to find the right method.
I should add that it is not an option to create the entire spreadsheet, as it is big and has various worksheets (the worksheet where the 5 values need to be added is always called "Inputs").
Hope someone can help.
Many thanks
Les
I have a form with a button whose event procedure currently copies a certain excel spreadsheet to a known path and file name, and then it opens the spreadsheet. The user then enters 5 values into 5 specific cells (always the same cells), then closes the spreadsheet, then clicks a second button that emails the spreadsheet to a recipient.
This all works fine, but it would be much better if the first procedure could assign the 5 values automatically to the 5 cells: the values are all available from the form that is currently open (and which has the two buttons). So in plain language I need something like:
copy the spreadsheet to the specified path and filename
open the spreadsheet
set spreadsheet cell D:13 to [forms]![frm mydata]![txtCode]
set spreadsheet cell T:22 to [forms]![frm mydata]![txtName]
set spreadsheet cell V:2 to [forms]![frm mydata]![txtCategory]
set spreadsheet cell W:42 to [forms]![frm mydata]![txtSerial]
set spreadsheet cell V:22 to [forms]![frm mydata]![txtStartDate]
Save and Close spreadsheet
Email spreadsheet
All the above is currently being done except the 5 'Set' lines! I'm sure this isn't too difficult, but despite googling it at length I can't seem to find the right method.
I should add that it is not an option to create the entire spreadsheet, as it is big and has various worksheets (the worksheet where the 5 values need to be added is always called "Inputs").
Hope someone can help.
Many thanks
Les