Trying to export multiple outlook appointments form excel file

jm336444

New Member
Joined
Mar 14, 2014
Messages
1
I am trying to take data from an excel file an export each row into a new calendar appointment in Outlook.

I am struggling to figure out the Body of the appointment and how I can export the excel data in correctly.
When I copy a cell in column f, it will copy all of the text, when I run the macro, it only pastes the first line.
After that is pasted correctly, I want to include the hyperlinks as a reference.
Currently this is not even displaying, but if/when it does,
I want it to read: TEXT - HYPERLINK (image attached in thread)
Once the macro reaches an empty cell, I want it to drop down to the next row and repeat the process.

Thanks in advance for your help (this has been a week long endeavor, and I am at my wits end...not very talented with VBA yet).

I will send files upon request. I couldn't figure out how to attach the excel file and the images of the appointments.

Below is the Macro.:

Sub CreateIcs()

Dim b As Range
Dim icsTxt As String
Dim fileBasePath As String

fileBasePath = "D:\Users\jmiller\Desktop\test\"

Set objFSO = CreateObject("Scripting.FileSystemObject")

For Each b In Selection.Rows

icsText = icsText + "BEGIN:VCALENDAR" + vbCrLf
icsText = icsText + "PRODID:Commercial Ops" + vbCrLf
icsText = icsText + "VERSION:2.0" + vbCrLf
icsText = icsText + "METHOD:PUBLISH" + vbCrLf
'This creates individual appointments
icsText = icsText + "X-MS-OLK-FORCEINSPECTOROPEN:TRUE" + vbCrLf

icsText = icsText + "BEGIN:VEVENT" + vbCrLf
icsText = icsText + "SUMMARY;LANGUAGE=en-us:" + Cells(b.Row, 5) + vbCrLf
icsText = icsText + "LOCATION:" + Cells(b.Row, 4) + vbCrLf
'This is where I am struggling....all of the text does not copy from the cell in column F.
'It only copies the 1st row of text within that cell (Alt+Enter was used to drop down to the next line within the cell)
icsText = icsText + "X-ALT-DESC;FMTTYPE=text/html:" + Cells(b.Row, 6) + vbCrLf
icsText = icsText + "X-ALT-DESC;FMTTYPE=text/html:" + Cells(b.Row, 10).Text + "-" + "NEED HYPERLINK HERE" + vbCrLf
icsText = icsText + "DTSTART;TZID=""Central Standard Time"":" + Format(Cells(b.Row, 2), "yyyymmddTHHMMss") + vbCrLf
icsText = icsText + "DTEND;TZID=""Central Standard Time"":" + Format(Cells(b.Row, 3), "yyyymmddTHHMMss") + vbCrLf


icsText = icsText + "END:VEVENT" + vbCrLf

icsText = icsText + "END:VCALENDAR" + vbCrLf

'MsgBox (icsText)

Set objFile = objFSO.CreateTextFile(fileBasePath + Cells(b.Row, 5) + ".ics")
objFile.WriteLine icsText
objFile.Close

Next b
MsgBox "Done!"

End Sub
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,216,167
Messages
6,129,262
Members
449,497
Latest member
The Wamp

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top