Sep 08 2021 03:23 PM
Hello,
I am trying to upload excel data into an Outlook calendar.
I have an error on my code on WScript "Variable Not Defined"
strFil = WScript.Arguments(0)
(row ~25)
I am not sure why.
I have attached the code in Notepad.
Do you see where the issue might be?
Note: I am not a coder.
thank you very much
Sep 08 2021 05:47 PM
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.
Sep 09 2021 01:05 PM
Sep 09 2021 01:59 PM - edited Sep 10 2021 01:39 PM
----Or---- it could be easier to provide guidance on how I could import the attached excel into Outlook.
Sep 10 2021 07:01 AM
Sep 10 2021 07:06 AM
Sep 10 2021 07:13 AM
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?
Sep 10 2021 01:44 PM
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.
Sep 10 2021 07:02 PM
Sep 10 2021 07:09 PM
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.
Sep 11 2021 10:04 AM
Hi George, hope you are enjoying the weekend.
Yes, it is a variable to set according to the Compile Error:
Sep 11 2021 10:57 AM
Sep 11 2021 03:10 PM
Sep 11 2021 03:11 PM
Sep 12 2021 05:51 AM
SolutionSep 12 2021 05:02 PM
Sep 12 2021 05:51 AM
Solution