Setting date and time in journal entry

C

Charles Kenyon

I have a form for recording a phone message. When done at the same time as
the call the journal date and time are fine. When recording a message from
voice mail, though, I would like the time to be when the message was left
rather than when it was picked up.

I have the following code, which sort of works. The commented out part,
though, does not.

Private Sub cmdOK_click()
Dim olApp As Outlook.Application
Dim objJournal As Outlook.JournalItem
Set olApp = Outlook.Application
Set objJournal = olApp.CreateItem(olJournalItem)
Me.Hide
With objJournal
.Type = "Phone call"
.Subject = txtName.Text & _
" " & txtPhone.Text
.Body = "Call from " & txtName.Text & vbCrLf _
& "Number: " & txtPhone.Text & vbCrLf _
& "==============================" & vbCrLf _
& txtMessage.Text
' If txtDate.Text <> "" Then
' .CreationTime = txtDate.Text
' End If
' If txtTime.Text <> "" Then
' .CreationTime = txtTime.Text
' End If
.Display
End With
End Sub

I guess I don't know what to save the date and time to. CreationTime is
apparently a read-only property. What are the names for the date and time
textboxes on the journal form itself?

TIA

--

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
S

Sue Mosher [MVP-Outlook]

When in doubt, check the object browser: Press ALt+F11 to open the VBA
environment in Outlook, then press F2. Switch from <All Libraries> to
Outlook to browse all Outlook objects and their properties, methods, and
events. Select any object or member, then press F1 to see its Help topic.
(HINT: Start)
 
C

Charles Kenyon

That gets me to:

If txtDate.Text <> "" Then
.Start = txtDate.Text & " " & txtTime.Text
End If

How would I put the date and time into the Start property? Does it require a
specific format?

It is probably easier for me to put this info into the subject and just
update the journal entry manually, but I am curious and would like to be
able to do this.

--

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
S

Sue Mosher [MVP-Outlook]

You can use the IsDate() function to see if it really is a date, then
convert it with CDate():

strDateTime = txtDate.Text & " " & txtTime.Text
If IsDate(strDateTime) Then
.Start = CDate(strDateTime)
End If

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Charles Kenyon said:
That gets me to:

If txtDate.Text <> "" Then
.Start = txtDate.Text & " " & txtTime.Text
End If

How would I put the date and time into the Start property? Does it require
a specific format?

It is probably easier for me to put this info into the subject and just
update the journal entry manually, but I am curious and would like to be
able to do this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top