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.
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.
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, 2021Iron 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 Contributor
Actually, I wonder if this is new code to you? Did it ever work?
WScript.Arguments(0) strikes me as being something from a Windows Script, not in VBA. I made the mistake of thinking it was a variable you'd set yourself.
- Tony2021Sep 11, 2021Iron Contributor
Hi George, hope you are enjoying the weekend.
Yes, it is a variable to set according to the Compile Error:
- George_HepworthSep 11, 2021Silver ContributorOkay. Check your references and see if one refers to "Scripting"