Re: Can I learn VBA quickly and how?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



If you have some programming experience, it should be a breeze. My
recommendation would be to look at some introductory material for
Visual Basic 6.0, as this will give you both the working basics of the
language, and also basics of programming. Another good choice would
be Excel 200x VBA Programmer's Reference or Excel 200x VBA Power
Programming, both of which start at the beginning and provide VBA-
specific material. Any of these references will also give you a
sufficient introduction to how classes work - critical for VBA,
because just about everything is a class object or a member of one.

Here's an example of a simple spreadsheet application working with
Outlook. Column A contains task names; column B contains due dates.
Placed inside a worksheet's code module, it processes input in cells
B2:B50 (leaving row 1 for headers), and creates an outlook task item.
I put comments to help you figure out what's going on. Try it out:


Private Sub Worksheet_Change(ByVal Target As Range)
' only using range B2:B50
If Not (Intersect(Target, Me.Range("B2:B50")) _
Is Nothing) Then

' these are the objects we're working with
Dim objOutlook As Object
Dim objItem As Object
Dim blnOutlookRunning As Boolean
Dim dtDueDate As Date

' make sure a date is entered
On Error Resume Next
dtDueDate = Target.Value
On Error GoTo 0

' if a date is not entered,
' alert user and clear input
If dtDueDate = 0 Then
Call MsgBox("Enter a date!", vbExclamation)
Application.EnableEvents = False
Target.Clear
Application.EnableEvents = True
Exit Sub
End If

' check to see if outlook is already running
On Error Resume Next
Set objOutlook = GetObject(, _
"Outlook.Application")
blnOutlookRunning = True
On Error GoTo 0

' if outlook is not running, start it
If objOutlook Is Nothing Then
blnOutlookRunning = False
Set objOutlook = _
CreateObject("Outlook.Application")
End If

' create a new item
Set objItem = _
objOutlook.CreateItem(olTaskItem)

' set item properties based on spreadsheet
With objItem
.DueDate = dtDueDate
.Subject = "Get " & Target.Offset(0, -1).Value _
& " done by " & Target.Value
.Save
End With

' quit outlook if it wasn't running
If Not blnOutlookRunning Then
objOutlook.Quit
End If
End If
End Sub



On Nov 7, 10:52 am, sue2uk <sue...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
This was my original question on the Excel discussion group:
"I have a couple of rental properties abroad and have a simple Excel
spreadsheet with details of the booking, client, deposit paid, date balance
due etc. Is there any way that this can be linked to Outlook as a task or in
the calendar to alert me on the due date to remind me to chase the client for
payment of their balance?"
It was suggested that I look for a VBA solution - is this something I can do
myself, learn quickly, where do I start, any suggestions? (I did some
programming briefly about 20 years ago!!!!)


.



Relevant Pages

  • Re: Microsoft Outlook Web Access
    ... OO programming and .NET are supposed to be the cat's meow, ... NOT Outlook Express, the full version. ... That is what I use at home and I do not have any of the problems I mentioned, with it, only with the Web Access version that I use at work. ... The same procedure of mouse click and key strokes work consistently in Explorer and Outlook 2003 and I believe in most if not all Windows programs, but they produce different results in the Web Access Outllook. ...
    (comp.lang.cobol)
  • Re: OT Registry cleaners
    ... COBOL is a read only language. ... What we need is a perl to COBOL translator. ... "It is practically impossible to teach good programming to students ... the BASICs of today aren't comparable to the basics of ...
    (talk.origins)
  • Re: Flamewar _ DO NOT READ
    ... Without having to buy expensive development kits ... ... I think the point you were trying to make, and it may be a valid one, is that it's one of the last that comes with a programming environment *that's designed for ease of learning by beginning programmers*. ... BASICs, Logo, Smalltalks, and some of the Lisp derivatives provide that, and of those, Logo and some of the BASICs and Smalltalks are relatively easy to learn too. ... More commonly, it's the shell, Explorer, that gets into a wonky state and needs restarting, but you lose all your open-folder-window session state if you restart Explorer in any other way than by rebooting. ...
    (rec.games.roguelike.angband)
  • Re: Outlook 07 Custom Task Form and SQL
    ... If you want to save the list, you could put it in a StorageItem object in a mail/post public folder. ... Author of Microsoft Outlook 2007 Programming: ... I created the custom form, for which you've seen the code. ...
    (microsoft.public.outlook.program_forms)
  • Re: With all do respect Gentlemen
    ... I have always been told that the only stupid question is the one you ... 1984 I started programming on my first IBM PC ... IT's not that your questions are stupid, it's that you obviously haven't even bothered looking at the manual to discover the very basics. ... If you really did teach yourself all those languages, then you should be at least starting with this one by making an effort to discover the very basic steps, before asking for help. ...
    (comp.lang.php)