AboutSyed Rizwan Muhammad Rizvi Expertise I can answers questions regarding web based and desktop based programming in VB.Net. Which can include SOAP, XML, Custom Controls, COM Interoperability etc.
Experience Have been working in this specific area for last 2 years previously I was a VB 6 Developer with experties in other languages as well. Total 10 years of programming experience.
Question QUESTION: hi,
I am trying to declare a variable to Outlook.CalendarView but the VB Script is not recognizing it and i am getting error. can u please suggest me what is the component/reference file that needs to be included to remove this error
Here is the code snippet of how i am declaring the variable
Dim oCV As Outlook.CalendarView
Dim objMAPIFolder As Outlook.MAPIFolder
oCV = objMAPIFolder.CurrentView
oCV.CalendarViewMode = olCalendarViewDay
oCV.GoToDate DateValue(DTPicker1.Value)
ANSWER: If you are using VB Script then you cant use early binding you will have to use late binding i.e.
Dim oCV
Set oCV = Createobject("Outlook.CalendarView")
---------- FOLLOW-UP ----------
QUESTION: I have tried the Above syntax but at run time it is showing exception " An Unhandled Exception of type "System.Exception' occured in microsoft.visualbasic.dll"
and it says it cannot create ActiveX component. Should we need to add any components to the project so as to make it recognize this command?? if so please suggest me the required component to be added
Answer I think you wrote VBScript in your question not VB.net?
Please confirm what are you using? VB.Net or VBScript.
If you are using VB.net then you your previous syntax is OK. you just need to replace the line:
Dim oCV As Outlook.CalendarView
to
Dim oCV As new Outlook.CalendarView