+ Reply to Thread
Results 1 to 4 of 4

Integrate Excel into Outlook

Hybrid View

  1. #1
    Registered User
    Join Date
    12-16-2011
    Location
    Columbia, Mo
    MS-Off Ver
    Excel 2010
    Posts
    5

    Integrate Excel into Outlook

    I have beyond boggled my mind trying to make my job a bit simpler or less time consuming. I have spent about an hour but have not found an answer yet, so I am not sure if this is possible at all.

    This is what I have::
    I have multiple worksheets of brand analysis statistics. I download about 300 of these a day, each worksheet has multiple equations, I need one total at the end (same cell on every worksheet) to be placed into a calendar(I was hoping outlook so I could sync it with my blackberry) with the name of the worksheet or document and the total of that cell on the correct day. Is it possible?

    I am hoping the first option will work, but if not, will this second option work outside of my head? If I make 1 workbook with all the worksheets per day (I am not sure how many I can have) copied into a template then make a workbook of January-December calendars, can I somehow link all the different cells I need in a calendar in a different file, maybe referencing between files?

    Any help would be greatly appreciated!
    Nikki

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Can I integrate Excel into Outlook

    Sounds possible. Some questions...

    Where are the 300 workbooks - are they in the same folder? Are there new ones every day or it it the same ones updated. What would the Outlook item be - a mail message or something else?

  3. #3
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Can I integrate Excel into Outlook

    I do something similar, try the below, you might need to adapt it a bit to meet your needs, but if you've got any questions please ask.

    I've set the url to one you will be able to download (thanks Jerry )
    Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
      "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal _
        szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
     
    Public Sub SaveTaskfromWeb()
        
        Const startHour As String = "09:00"
        Const url As String = "https://sites.google.com/a/madrocketscientist.com/jerrybeaucaires-excelassistant/files/3D-VLOOKUP%26HYPERLINK.xls"
        
        Dim startTime As String
        Dim fPath As String
        Dim cValue As String
        Dim wb As Workbook
        Dim fname As Variant
        
        On Error GoTo handler
        
        fPath = DownloadFilefrURL(url)
        Set wb = Workbooks.Open(fPath)
        With wb
            cValue = .Sheets("Sheet1").Range("A5").Text
            .Close False
        End With
        
        fname = Split(url, "/")
        fname = fname(UBound(fname))
        startTime = Format(Now() + 1, "dd/MM/yyyy " & startHour)
        
        If CreateAppointment(startTime, fname & " - " & cValue) Then
            MsgBox "Outlook appointment created", vbInformation
        Else
            MsgBox "Something went wrong, the appointment was not created.", vbCritical
        End If
      Exit Sub
    handler:
    
        If Err.Number = 76 Then
            MsgBox "The file was not downloaded, please check the url.", vbCritical
        Else
            MsgBox Err.Description, vbCritical
        End If
            
    End Sub
    
     
     
    Public Function DownloadFilefrURL(url As String) As String
        Dim strSavePath As String
        Dim ext As String
        Dim buf, ret As Long
        buf = Split(url, ".")
        ext = buf(UBound(buf))
        strSavePath = ThisWorkbook.Path & "\" & "DownloadedFile." & ext
        ret = URLDownloadToFile(0, url, strSavePath, 0, 0)
        If ret = 0 Then
            DownloadFilefrURL = strSavePath
        Else
            Err.Raise 76
        End If
    End Function
    
    Public Function CreateAppointment(startTime As String, Subject As String) As Boolean
    
      Dim oApp As Object
      Dim oNameSpace As Object
      Dim oItem As Object
      Dim iLastRow As Long
      Dim irow As Long
         
      On Error Resume Next
      Set oApp = GetObject("outlook.application")
      If Err <> 0 Then
        Set oApp = CreateObject("Outlook.Application")
      End If
      
      Err.Clear
      
      On Error GoTo handler
      
      Set oNameSpace = oApp.GetNamespace("MAPI")
      
      Set oItem = oApp.CreateItem(1)
      With oItem
        .Subject = Subject
        .Start = startTime
        .Display '.Save 'change to this if you'd rather save
        CreateAppointment = True
      End With
      
      Exit Function
      
    handler:
      CreateAppointment = False
    End Function
    Last edited by Kyle123; 12-17-2011 at 07:10 PM.

  4. #4
    Registered User
    Join Date
    12-16-2011
    Location
    Columbia, Mo
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Integrate Excel into Outlook

    mrice~the 313 are all in one folder. The files are new everyday. I would like the final total to be located on the calendar.

    Kyle123, thank you I will check this out after dinner

    Thank you very much for both of your responses.

    Nikki

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1