|
-
Sep 6th, 2009, 12:27 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Send e-mail to file
I would like to be able to put a UserForm in Outlook (2003) that the user sends to an excel file so that the excel file is updated. The story behind this is that there is a file that needs to be updated frequently in hot weather: the person who is in charge updating this file currently has to find the correct file (based on the date), put the latest observation in, and then do a copy & paste of some other information. The only actual new information is the number she inputs - the rest can be automated. (The reason I am looking at "e-mailing" to l,kkkka file (rather than a person) is that I am sure the user would have her Outlook up and running the whole time and would be more comfortable with an Outlook form than an excel form.)
My question is: can this be done? If it can, could I please have one or two pointers to set me in the right direction?
(If it can't be done, I could create an excel file that consists of a UserForm & a code to update the appropriate file.)
-
Sep 6th, 2009, 02:44 AM
#2
Re: Send e-mail to file
you can automate excel from outlook without problem
vb Code:
set xl = createobject("excel.application") set wb = xl.workbooks.open("c:\somefolder\hotweather.xls") wb.sheets("mysheet").range("a6").value = textbox1.text
this opens an instance of excel using late binding, you can use early binding if you feel more comfortable with it
if the workbook is being updated regularly it may be better to leave it open, using form level variables, then just save and close by button or form unload
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Sep 7th, 2009, 05:44 AM
#3
Thread Starter
Addicted Member
Re: Send e-mail to file
Dear westconn1
Thank you for your reply, it looks like it should do the trick. I'm still working on the code to find the file & the right sheet in the file (a logic problem, rather than a vba problem - I think I've got it sorted now).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|