Consulting

Results 1 to 3 of 3

Thread: New to VBA and not sure where to start

  1. #1

    New to VBA and not sure where to start

    Hello,

    I am new to the forum and very new to VBA. Basically I am just looking for a place to start. We do many events which include recording meetings. Thus we have an online calendar with info on each meeting.

    I want to be able to:
    Prompt the user to insert a unique ID which goes on the back end of a URL that opens in IE
    Takes the data that I need from the page such as email, meeting title, date and time.
    Create an outlook invite with the standard text we put into the body.
    Then the user can review the meeting invite and hit send if all the info is correct.

    Is the doable in VBA? Seems like it would be a perfect fit. I have been reading a book on coding VBA but is such a slow read. Is there a better way to learn this or should I push on?

    My experience with coding is not extensive, but I know Javascript, PHP, and HTML very well so I see some similarities, but my attention span for this book is really testing me. In the past I've learned code by creating, not by reading, but I am also having a hard time finding a launchpad.

    Any advice?

    Thanks in advance.
    Mike

  2. #2
    VBAX Tutor
    Joined
    Mar 2014
    Posts
    210
    Location
    Sounds like you'd have a box for their ID, and a button to start the app.
    The button would run the macro to pull the URL data
    then connect to Outlook and create the eVite.
    (see some code blocks below..these dont do EXACTLY what you want but its door to get you in.)

      '--- SEND AN EMAIL
    
    Public Function EmailO(ByVal pvTo, ByVal pvSubj, ByVal pvBody, ByVal pvFile) As Boolean
    Dim oApp As Outlook.Application
    Dim oMail As Outlook.MailItem
    On Error GoTo ErrMail
    Set oApp = CreateObject("Outlook.Application")
    Set oMail = oApp.CreateItem(olMailItem)
    With oMail
        .To = pvTo
        .Subject = pvSubj
        If Not IsNull(pvBody) Then .Body = pvBody
        .Attachments.Add pvFile, olByValue, 1
        .Send
    End With
    EmailO = True
    Set oMail = Nothing
    Set oApp = Nothing
    Exit Function
    ErrMail:
    MsgBox Err.Description, vbCritical, Err
    Resume Next
    End Function
    
      '--- PULL DATA FROM WEB SITE
    
    Function ExecuteWebRequest(ByVal url As String) As String
    Dim oXHTTP As Object
    If InStr(1, url, "?", 1) <> 0 Then
        url = url & "&cb=" & Timer() * 100
    Else
        url = url & "?cb=" & Timer() * 100
    End If
    Set oXHTTP = CreateObject("MSXML2.XMLHTTP")
    oXHTTP.Open "GET", url, False
    oXHTTP.send
    ExecuteWebRequest = oXHTTP.responseText
    Set oXHTTP = Nothing
    End Function

  3. #3
    That is a great start! Thanks, I'm sure I will be back with more questions.

    Cheers,
    Mike

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •