+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 21

Thread: Transfer data from Excel to Outlook Calendar

  1. #1
    Registered User
    Join Date
    01-07-2011
    Location
    Oslo, Norway
    MS-Off Ver
    MS Excel 2007, Norwegian version
    Posts
    10

    Question Transfer data from Excel to Outlook Calendar

    Hi,

    I have some data in my excel sheet, see picture.
    Now I want to transfer it to Outlook Calendar.

    http://img252.imageshack.us/img252/6...enshot032a.jpg

    How can I do that?


    I hope someone can help me

  2. #2
    Registered User
    Join Date
    01-07-2011
    Location
    Oslo, Norway
    MS-Off Ver
    MS Excel 2007, Norwegian version
    Posts
    10

    Re: Transfer data from Excel to Outlook Calendar

    I also have a CSV file, if that is easier.

    Just let me know if you want more information!

  3. #3
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    mineral city, ohio
    MS-Off Ver
    Excel 2007; Excel 2000
    Posts
    4,004

    Re: Transfer data from Excel to Outlook Calendar

    Hi Hatye

    See this thread. It sounds like what you're doing http://www.excelforum.com/excel-prog...-calender.html

    John
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Registered User
    Join Date
    01-07-2011
    Location
    Oslo, Norway
    MS-Off Ver
    MS Excel 2007, Norwegian version
    Posts
    10

    Re: Transfer data from Excel to Outlook Calendar

    Thanks John!

    Attached you can find my excel workbook. It is the 2nd sheet that I use when I transfer to Outlook, and the sub I have edited is "Transfer_Outlook" (the one at the top of the module).

    It is not working correctly, do you know what's wrong? Nothing is correctly transferred, and I am not a master in VBA.

    I look forward for help

    -Idar
    Attached Files Attached Files

  5. #5
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    mineral city, ohio
    MS-Off Ver
    Excel 2007; Excel 2000
    Posts
    4,004

    Re: Transfer data from Excel to Outlook Calendar

    Hi Hatye

    Couple things. This line of code evaluates to 100
    LR = Ark2.Range("A" & Rows.Count).End(xlUp).Row
    when you have only 27 rows in column A of Ark2 so you need to delete all the extraneous data below your last row.

    Secondly
    Public strName As String
    isn't defined anywhere in the code you posted so, the code isn't finding any records. What is strName and where does the value come from?

    Can't test the code until this is defined.

    Alternately, simply explain what it is you wish to do. Perhaps I can help.

    John
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  6. #6
    Registered User
    Join Date
    01-07-2011
    Location
    Oslo, Norway
    MS-Off Ver
    MS Excel 2007, Norwegian version
    Posts
    10

    Re: Transfer data from Excel to Outlook Calendar

    This line of code evaluates to 100
    It is because I need to use the sheet for several school subjects, such as math, finance, economy and so on. Therefore I don't know how many rows that are filled. In sheet 1 I paste my school schedule from our web solution (one by one), and I sort it in the second sheet and use IF-formulas. Since different subjects may have different numbers of lessons, I did it that way. Is there a way to fix it?

    About the secondly, I actually don't know why it is there. I pasted it from the link you sent me. I don't know very much about programming, I usually use the recorder.

    What I want to do is transferring from Excel to Outlook Calendar with:
    Subject: Column A
    Start date: B
    Start time: C
    End date: D
    End time: E
    Place: H
    Category: I
    Body: 1.line: F. 2.line: G
    Reminder: None

    PS! I have deleted the column "All day event".

    Do you understand what I want to do?


    Thank you so much for your help; I really appreciate it!!

  7. #7
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    mineral city, ohio
    MS-Off Ver
    Excel 2007; Excel 2000
    Posts
    4,004

    Re: Transfer data from Excel to Outlook Calendar

    Hi Hatye
    Yes, I
    understand what I want to do
    I'll work on this for you.

    John
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  8. #8
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    mineral city, ohio
    MS-Off Ver
    Excel 2007; Excel 2000
    Posts
    4,004

    Re: Transfer data from Excel to Outlook Calendar

    Hi Hatye

    You'll notice that I made very few changes to your original code; your offsets were off.
    Option Explicit
    Sub Transfer_Outlook()
        Dim objApp As Outlook.Application
        Dim objNS As Outlook.Namespace
        Dim objFolder As Outlook.MAPIFolder
        Dim objRecip As Outlook.Recipient
        Dim objAppt As Outlook.AppointmentItem
        Dim UseSubject As String
        Dim UseLocation As String
        Dim UseBody As String
        Dim UseDate As Date
        Dim UseCategory As String
        Dim LR As Long
        Dim nCell As Range
        Dim Rng As Range
        Dim StartTime As String
        Dim EndTime As String
        On Error Resume Next
        Set objApp = CreateObject("Outlook.Application")
        On Error GoTo 0
        LR = Ark2.Range("A" & Rows.Count).End(xlUp).Row
        Set Rng = Ark2.Range("A2:A" & LR)
        For Each nCell In Rng
            If Not nCell = "" Then
                On Error Resume Next
                Set objNS = objApp.GetNamespace("MAPI")
                Set objFolder = objNS.GetDefaultFolder(olFolderCalendar)
                UseSubject = nCell.Offset(0, 0).Value '& " - " & nCell.Offset(0, -4).Value
                UseDate = nCell.Offset(0, 1).Value
                UseLocation = nCell.Offset(0, 7).Value
                UseBody = nCell.Offset(0, 6).Value
                UseCategory = nCell.Offset(0, 8).Value
                StartTime = nCell.Offset(0, 2).Value
                EndTime = nCell.Offset(0, 4).Value
                If Not objFolder Is Nothing Then
                    Set objAppt = objFolder.Items.Add
                    If Not objAppt Is Nothing Then
                        With objAppt
                            .Start = UseDate + StartTime
                            .End = UseDate + EndTime
                            .Subject = UseSubject
                            .Location = UseLocation
                            .Body = UseBody
                            .Category = UseCategory
                            .Save
                        End With
                    End If
                Else
                    'MsgBox "Could not find " & Chr(34) & nCell & Chr(34), , _
                            "User not found"
                End If
                On Error GoTo 0
            End If
        Next nCell
        Set objApp = Nothing
        Set objNS = Nothing
        Set objFolder = Nothing
        Set objRecip = Nothing
        Set objAppt = Nothing
    End Sub
    Let me know of issues.

    John
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  9. #9
    Registered User
    Join Date
    01-07-2011
    Location
    Oslo, Norway
    MS-Off Ver
    MS Excel 2007, Norwegian version
    Posts
    10

    Re: Transfer data from Excel to Outlook Calendar

    Let me know of issues.
    I have only one question. It don't categorizes. Do you know what's wrong?

  10. #10
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    mineral city, ohio
    MS-Off Ver
    Excel 2007; Excel 2000
    Posts
    4,004

    Re: Transfer data from Excel to Outlook Calendar

    Hi Hatye

    I assume you have "Skole" set up as a Category in Outlook. Assuming you do, you need to change this line of code from
    .Category = UseCategory
    to
    .Categories = UseCategory
    Let me know of issues.

    John
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  11. #11
    Registered User
    Join Date
    01-07-2011
    Location
    Oslo, Norway
    MS-Off Ver
    MS Excel 2007, Norwegian version
    Posts
    10

    Re: Transfer data from Excel to Outlook Calendar

    Let me know of issues.
    Hi again, and thank you for responding

    In Outlook I have a category called "Skole" (Norwegian for school).
    I have tried both "Category", "Categorise" and "Categorize" without any luck.

    Do you know what's wrong; and is it working for you?

  12. #12
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    mineral city, ohio
    MS-Off Ver
    Excel 2007; Excel 2000
    Posts
    4,004

    Re: Transfer data from Excel to Outlook Calendar

    Hi Hatye

    Have you tried Categories ?

    .Categories = UseCategory
    Yes, the above code works for me.

    John
    Last edited by jaslake; 01-09-2011 at 03:00 PM.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  13. #13
    Registered User
    Join Date
    01-07-2011
    Location
    Oslo, Norway
    MS-Off Ver
    MS Excel 2007, Norwegian version
    Posts
    10

    Re: Transfer data from Excel to Outlook Calendar

    Oh, I must have miss-spelt it. Now it works great!

    Thank you so much for help and patience I couldn't have done this without you!

  14. #14
    Forum Guru snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,151

    Re: Transfer data from Excel to Outlook Calendar

    Sub tst()
      sq = Sheets(1).Cells(1).CurrentRegion
    
      With CreateObject("outlook.application")
        For j = 2 To UBound(sq)
          With .createitem(1)
            .Subject=sq(j,1)
            .Start=sq(j,2) + sq(j,3)
            .End=sq(j,4) + sq(j,5)
            .Body=sq(j,7)
            .Location=sq(j,8)
            .Categories=sq(j,9)
            .Save
          End With
        Next
      End With
    End Sub
    Last edited by snb; 01-09-2011 at 04:33 PM.



  15. #15
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    mineral city, ohio
    MS-Off Ver
    Excel 2007; Excel 2000
    Posts
    4,004

    Re: Transfer data from Excel to Outlook Calendar

    Glad it works for you. If your issue is resolved, please mark your thread solved.

    John
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0