Creating New Apointemnt from HTML file.

D

Dave the Wave

I would like to extract schedule information from an html file that I
could then add to my appointment information in Outlook.

I have programmed Excel, and Access using VBA, but I do not know which
objects to use to accomplish my goal. If someone would outline what I
need to do and tell me the objects I need to locate the html file,
search for the right text, then create the new appointment I think I
could finish it from there.

Thanks in advance.
 
M

Michael Bauer [MVP - Outlook]

In Outlook, this creates a new appointment:

Dim Appt as Outlook.AppointmentItem
Set Appt=Application.CreateItem(olAppointmentItem)

For all the avialable properties, please see the object browser (f2), select
the AppointmentItem in the left pane.

For extracting data from any file, you may use the functions Left, Right,
Mid, and Instr, maybe also InStrRev. Just type a function name with the open
bracket, and the IDE tells you somethign about the arguments, or press f1
for more help.

--
Best regards
Michael Bauer - MVP Outlook

: VBOffice Reporter for Data Analysis & Reporting
: Outlook Categories? Category Manager Is Your Tool:
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Sat, 14 Jun 2008 15:01:24 -0400 schrieb Dave the Wave:
 
D

Dave the Wave

In Outlook, this creates a new appointment:

Dim Appt as Outlook.AppointmentItem
Set Appt=Application.CreateItem(olAppointmentItem)

For all the avialable properties, please see the object browser (f2), select
the AppointmentItem in the left pane.

For extracting data from any file, you may use the functions Left, Right,
Mid, and Instr, maybe also InStrRev. Just type a function name with the open
bracket, and the IDE tells you somethign about the arguments, or press f1
for more help.

Thanks Michael.
As I was further thinking about it, it occurred to me that it would be
even better if Outlook could be made to retreive the web page and
extract the data without me having to manually save the html file adn
then run my import code.

Can Outlook retreive web pages in this manner?
 
M

Michael Bauer [MVP - Outlook]

I'm not sure what you're asking for. You may set a folder to display a
webpage but Outlook wouldn't extract any informations for you. For that
please see the MapiFolder.WebView* properties.

--
Best regards
Michael Bauer - MVP Outlook

: VBOffice Reporter for Data Analysis & Reporting
: Outlook Categories? Category Manager Is Your Tool:
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Sun, 15 Jun 2008 12:45:48 -0400 schrieb Dave the Wave:
 
D

Dave the Wave

I'm not sure what you're asking for. You may set a folder to display a
webpage but Outlook wouldn't extract any informations for you. For that
please see the MapiFolder.WebView* properties.

The company I work for posts our schedules on line. I viewed the HTML
text for the web page where my shifts are displayed. Since the HTML
file is just plain text I assume I can write code that would search
through the text, extract the date/start-time/end-time data, then use
the data to create an appointment.

I thought, since Outlook displays emails that contain text or HTML,
there might be Outlook properties and methods I could use. (Perhaps I
will have to instantiate Word or IE to get to the raw schedule data.)

I have a good idea how to create the new appointments using Outlook
objects and methods. It's getting the data from the web page that I'm
unclear on how to best proceed.

Thanks very much for your comments.
 
M

Michael Bauer [MVP - Outlook]

You may use the IE to download the file:

Private WithEvents IE As InternetExplorer

Private Sub IE_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Debug.Print pDisp.Document.Body.innerText
End Sub

Sub Start()
Set IE = New InternetExplorer
IE.Navigate2 "http://www.vboffice.net"
End Sub

Then use the mentioned functions to extract what you're looking for.

--
Best regards
Michael Bauer - MVP Outlook

: VBOffice Reporter for Data Analysis & Reporting
: Outlook Categories? Category Manager Is Your Tool:
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Mon, 16 Jun 2008 13:07:04 -0400 schrieb Dave the Wave:
 
D

Dave the Wave

You may use the IE to download the file:

Private WithEvents IE As InternetExplorer

Private Sub IE_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Debug.Print pDisp.Document.Body.innerText
End Sub

Sub Start()
Set IE = New InternetExplorer
IE.Navigate2 "http://www.vboffice.net"
End Sub

Then use the mentioned functions to extract what you're looking for.

Michael:
Thank you very much for taking the time to help me get started. I
greatly appreciate it.!

Best wishes,
David Glotfelty
 
D

Dave the Wave

You may use the IE to download the file:

Private WithEvents IE As InternetExplorer

Private Sub IE_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Debug.Print pDisp.Document.Body.innerText
End Sub

Sub Start()
Set IE = New InternetExplorer
IE.Navigate2 "http://www.vboffice.net"
End Sub

Then use the mentioned functions to extract what you're looking for.

I tried to use your code but I get an error message about user type
not defined. VBA doesn't like:

"Private WithEvents IE As InternetExplorer"

Is the type name "InternetExplorer" not correct?
 
M

Michael Bauer [MVP - Outlook]

The name is correct. Yo need to set a reference to the library 'Microsoft
Internet Controls' via Tools/References.

--
Best regards
Michael Bauer - MVP Outlook

: VBOffice Reporter for Data Analysis & Reporting
: Outlook Categories? Category Manager Is Your Tool:
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Tue, 17 Jun 2008 19:04:46 -0400 schrieb Dave the Wave:
 
Top