Forum Discussion
Importing Data into Outlook Calendar
- Sep 12, 2021Given the fact that this is not your own code, and that particular reference appears to be unexplainable given what we can see, I might want to go to the source of the code and ask for clarification. I suspect that you are missing some important part of the full code. As I think I mentioned in a previous post, I would expect the WScript reference to pertain to a Windows scripting function anyway.
Two questions.
One. This forum is devoted to the MS Access application, used to create relational database applications. So, are you trying to import data in Outlook from Excel from code running in an Access module? Or in Outlook? Or in Excel? (Well, three questions about one topic.)
Two, you show only one line, the one with the error. The error message is telling you that you are trying to use an undefined variable, and you've bolded the word "WScript" so we are to assume, I guess, that this is the undefined variable.
Maybe if you show us the entire procedure (Sub or Function) we can help clarify why that variable isn't defined.
To answer your queries:
<So, are you trying to import data in Outlook from Excel from code running in an Access module? Or in Outlook? Or in Excel? (Well, three questions about one topic.)
Answer: Yes. My data resides in Access, then I dump it to excel then upload into Outlook.
<Maybe if you show us the entire procedure (Sub or Function) we can help clarify why that variable isn't defined.
Yes, I think its in the zipped attachment? The function is called "OutlookCalendarScript" which is inside the text file.
Let me know if there is something I have missed.
- George_HepworthSep 10, 2021Silver ContributorWhy move the data through Excel at all? I'm not sure I understand that part.
- George_HepworthSep 10, 2021Silver Contributor
I see the text.
So this is running from Access. Apparently you first export the data from Access to Excel (in a different function?) Why do that? Is there some additional formatting being done in Excel? How does this data get stored in Access?
Also, many of your variables are Dimmed this way.
Dim excApp, excWkb, excWks, excCel
This results in variant type variables. I suspect what you want are Excel Objects here, but if you do want the variant datatype, it's okay.
I see you use WScript without previously dimming or setting it. I can't see how that can work. Where does that come from?
- Tony2021Sep 10, 2021Steel Contributor
Hi George,
I do extra formatting and combining fields and preparing it for importing into Outlook. My data is initially in excel then I import into Access, manipulate it then re-export to excel then into Outlook. I use to be able to skip the re-export to excel by using the script.
I am not sure where that Wscript came from. It is only in the code I posted. I searched my access database and I do not see it anywhere else but in that function OutlookCalendarScript(). I thought maybe there is a reference or something that I need to update but I dont see any missing references either.
I think I will have to end up importing into Outlook manually. I have actually managed to do this and it works better than expected. its one more step but I can deal with it.
thank you for your assistance. Have a good weekend.
- George_HepworthSep 11, 2021Silver ContributorOkay. Check your references and see if one refers to "Scripting"