Home

Cardbox Talk

 

CardboxForumsCardbox Talk > "Cardbox & MS Outlook"

Cardbox & MS Outlook

Can Cardbox work with MS Outlook's calendar ?

Current user: [none]
Register / Log In · Help

Posted By Post

SHopkin

3-Mar-2009 14:50

We currently use Cardbox to keep track of our clients and log calls etc.... We have a field for "Next Call Back Due" and I was wondering if this can be linked in some way to put an entry into Outlook's Calendar ?

bert

3-Mar-2009 15:25

If you can script it in Outlook - you can script/macro it in Cardbox!

Searching in VBA Help of Outlook you can find AppointmentItem-objects.

So it will certainly be possible...

Regards
bert

SJSeager

3-Mar-2009 16:30

Cardbox is great for linking into Office products, check out the programming help for examples.
A simple example of what you need will be along the lines of the following, save this as a .cbs file (ie NextCall.cbs) and link it to a push button.
You will need to change ContactName, CompanyName and so that it collects the right data.

>
Dim objOutlook
Const olAppointmentItem= 1
Set cbx = GetObject(, "Cardbox.Application")
Set win = cbx.ActiveWindow
Set recs = win.Records
set REC = WIN.ACTIVERECORD

' Change these lines below to reflect the fields from your Cardbox database
ContactName = Fields("Name of your contacts field")
CompanyName = Fields("Name of your contacts company name field")
SDate = Fields("Date your going to call back field")

CTime = " 09.00"

'Create Outlook Object and Appointment (calendar) Item
    Set objOutlook = CreateObject("Outlook.application")
    Set olAppt = objOutlook.CreateItem(olAppointmentItem)

     olAppt.Subject = "Call " + ContactName
     olAppt.location = " of " + CompanyName
     olAppt.Body = " Reminder set from Cardbox " + cstr(now)
     olAppt.AllDayEvent = 0
     olAppt.Start = Cstr(SDate) &CTime
     olAppt.End = Cstr(SDate) &CTime
     olAppt.ReminderSet = True
     olAppt.Save

set objOutlook = nothing
set cbx = nothing

SHopkin

9-Mar-2009 15:20

Thank you both for your replies. I am definately a "non-techie" though having been user since Cardbox's DOS days my experience is limited to designing simple files and recording macros. SJSeager - is the example you provided a macro that I can save in Cardbox ?

SHopkin

9-Mar-2009 15:49

SJSeager - I have saved your example as a macro in Cardbox (field names adjusted) and it seems to work ! However, couldnt locate the entry in Outlook but have had a reminder for a call back that is 5697 weeks overdue! There is obviously someone wrong in my SDate field .. currently we enter dates as 9/3/2009 ... do you have any suggestions ?

Shaun

9-Mar-2009 16:47

SHopkin,

In times like these you need to make great use of the script command 'MsgBox' just to check what you are actually picking up compared to what you think you are picking up.
Msgbox displays a message or value on the screen.

Try putting the command MsgBox(SDate) under the line SDate = ... This will let you double check what you are getting (i'm guessing that 5697 weeks out is more or less 1/1/1990)
As a 'non techie' I suggest you make MsgBox one your favourite commands in scripting and use it often until you are 100% happy with your macro!

SHopkin

11-Mar-2009 11:55

Thank you all for your assistance - we now have a very useful additional feature. I'll start a new thread for my next project.

cardboss

23-Mar-2009 21:34

One note on this: it relies on Outlook interpreting strings as dates/times in a particular way. For instance, "9/3/2009 09:00" as the 9th of March 2009 at 9am. I may be wrong, but I suspect that this may vary according to the current regional settings of your computer. In the United States, for instance, this may become the 3rd of September.

I'd feel safer doing it something like this:

   SDate=Fields("Date your going to call back field")
   SDate=SDate & ".09.00"

-- This will give a string that looks like 9/3/2009.09.00, which Cardbox understands as 9 March 2009 at 9am.

   SDate=DateFromCardbox(SDate)
   olAppt.Start=SDate
   olAppt.End=SDate

-- DateFromCardbox translates this string into a VBScript date - not a string of characters that we hope Outlook will understand as a date, but a genuine date.

Doing it like this gives you more control and certainty. Because you're using a Cardbox function to convert the string to a date, you know that any Cardbox date format will be accepted. Because you're passing a date, not a string, to Outlook, you know that you are immune from any settings that may change the way that Outlook processes strings into dates.

Quick Reply

Please log in or register before trying to post a reply.

 
© 2010 Cardbox Software Limited   Home