AllExperts > Experts 
Search      

VB.NET

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More VB.NET Answers
Question Library

Ask a question about VB.NET
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Syed 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.

 
   

You are here:  Experts > Computing/Technology > Basic > VB.NET > how to access Outlook.CalendarView object

Topic: VB.NET



Expert: Syed Rizwan Muhammad Rizvi
Date: 4/27/2007
Subject: how to access Outlook.CalendarView object

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


Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.