Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Calender Issues


I'm a new VBA user and have been trying to learn how to expor
information from a particular worksheet to Outlook calender. i hav
read the tutorial on www.dicks-clicks.com and have gotten that to wor
just fine. What I'm running right now is (i'm want to use late bindin
as opposed to early binding):

Private Sub CommandButton2_Click()

Dim olApp As Object
Dim olApt As Object

Set olApp = CreateObject("Outlook.application")
Set olApt = olApp.CreateItem(1)

With olApt
.Start = Date + 1 + TimeValue("19:00:00")
.End = .Start + TimeValue("00:30:00")
.Subject = "Piano lesson"
.Location = "The teachers house"
.Body = "Don't forget to take an apple for the teacher"
.BusyStatus = 2
.ReminderMinutesBeforeStart = 120
.ReminderSet = True
.Save
End With

Set olApt = Nothing
Set olApp = Nothing

End Sub

How to I use information from particular cells as opposed to typing i
in VBA. for example, instead of ".Start = Date + 1
TimeValue("19:00:00")" how would i have it pull the data from, say
cell E1 (which could be simply be "6/6/05" for example). so, basicall
i'm looking for .Start=E1. I also want the other information to b
pulled from other cells. so instead of typing ".Body = "Don't forget t
take an apple for the teacher'" how do I get .Body to pull and displa
the text from cell E2 for example. Much thanks to those that help m
solve my quandary

--
littlegreenmen
-----------------------------------------------------------------------
littlegreenmen1's Profile: http://www.excelforum.com/member.php...fo&userid=2397
View this thread: http://www.excelforum.com/showthread.php?threadid=37689

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default Calender Issues

It's quite simple. You just reference the cell as follows

.Start = cdate(sheets(1).Range(e1).value) + 1 + TimeValue("19:00:00")
.End = .Start + TimeValue("00:30:00")
.Subject = "Piano lesson"
.Location = "The teachers house"
.Body = sheets(1).range(e2).value

I have added what appear to be missing dots at the start of these lines and
qualified the sheet explicitly in case the sheet is not active.

You should also watch out with Outlook when using CreateObject since Outlook
doesn't run in multiple instances. First use (untested, just writing this on
the fly):

On error resume next
Set olApp = GetObject("Outlook.Application")
on error goto 0
if olApp is nothing then
set OlApp = CreateObject("Outlook.Application")
End if

Robin Hammond
www.enhanceddatasystems.com

"littlegreenmen1"
<littlegreenmen1.1q80uk_1118088328.2105@excelfor um-nospam.com wrote in
message news:littlegreenmen1.1q80uk_1118088328.2105@excelf orum-nospam.com...

I'm a new VBA user and have been trying to learn how to export
information from a particular worksheet to Outlook calender. i have
read the tutorial on www.dicks-clicks.com and have gotten that to work
just fine. What I'm running right now is (i'm want to use late binding
as opposed to early binding):

Private Sub CommandButton2_Click()

Dim olApp As Object
Dim olApt As Object

Set olApp = CreateObject("Outlook.application")
Set olApt = olApp.CreateItem(1)

With olApt
Start = Date + 1 + TimeValue("19:00:00")
End = .Start + TimeValue("00:30:00")
Subject = "Piano lesson"
Location = "The teachers house"
Body = "Don't forget to take an apple for the teacher"
BusyStatus = 2
ReminderMinutesBeforeStart = 120
ReminderSet = True
Save
End With

Set olApt = Nothing
Set olApp = Nothing

End Sub

How to I use information from particular cells as opposed to typing it
in VBA. for example, instead of ".Start = Date + 1 +
TimeValue("19:00:00")" how would i have it pull the data from, say,
cell E1 (which could be simply be "6/6/05" for example). so, basically
i'm looking for .Start=E1. I also want the other information to be
pulled from other cells. so instead of typing ".Body = "Don't forget to
take an apple for the teacher'" how do I get .Body to pull and display
the text from cell E2 for example. Much thanks to those that help me
solve my quandary.


--
littlegreenmen1
------------------------------------------------------------------------
littlegreenmen1's Profile:
http://www.excelforum.com/member.php...o&userid=23978
View this thread: http://www.excelforum.com/showthread...hreadid=376895



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Calender Issues


I appreciate the help. When i run the program now I get a run-time
error on the .Start line and on the .Body line. Below is a copy of my
finished code. Any suggestions are most appreciated.

Private Sub CommandButton2_Click()

Dim olApp As Object
Dim olApt As Object

Set olApp = CreateObject("Outlook.application")
Set olApt = olApp.CreateItem(1)

With olApt
..Start = CDate(Sheets(1).Range(e1).Value) + 1 +
TimeValue("19:00:00")
..End = .Start + TimeValue("00:30:00")
..Subject = "Piano lesson"
..Location = "The teachers house"
..Body = Sheets(1).Range(e2).Value
..BusyStatus = 2
..ReminderMinutesBeforeStart = 120
..ReminderSet = True
..Save
End With

Set olApt = Nothing
Set olApp = Nothing

End Sub


--
littlegreenmen1
------------------------------------------------------------------------
littlegreenmen1's Profile: http://www.excelforum.com/member.php...o&userid=23978
View this thread: http://www.excelforum.com/showthread...hreadid=376895

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Calender Issues


I solved the run-time error. it needed to be .Range("E1"). once
included the " " it worked fine. thank you very much for your help

--
littlegreenmen
-----------------------------------------------------------------------
littlegreenmen1's Profile: http://www.excelforum.com/member.php...fo&userid=2397
View this thread: http://www.excelforum.com/showthread.php?threadid=37689

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Calender Issues


I have modified the Calendar program to do what I need with on
exception. I have schedules that I need to export from severa
different Excel files. I need to run the exporter from each fil
everyday to update my Calendar. How can I have the macro erase al
items from the Outlook Calendar with a given address before it runs b
schedule exporting program? In other words: I run the Macro; it scan
the outlook calendar and erases all entries with an address of "12
Anywhere St"; then it scans my list of dates and copies them to th
Calendar. I already have the part written that scans my list of date
and copies them to Excel, it's just the erasing part I need help with.
Thank you very much

--
littlegreenmen
-----------------------------------------------------------------------
littlegreenmen1's Profile: http://www.excelforum.com/member.php...fo&userid=2397
View this thread: http://www.excelforum.com/showthread.php?threadid=37689

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
pop up calender Norm Excel Discussion (Misc queries) 2 April 15th 10 03:13 AM
pop up calender samy Excel Discussion (Misc queries) 0 June 25th 08 12:59 PM
Calender Antney Excel Discussion (Misc queries) 0 December 11th 06 10:42 PM
CALENDER smickParisTX Excel Discussion (Misc queries) 0 January 19th 06 06:19 PM
Calender Help Greg B... Excel Programming 10 March 3rd 05 06:07 AM


All times are GMT +1. The time now is 08:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"