Embed or Show Google Calendar Events (1 Viewer)

bignose2

Registered User.
Local time
Today, 22:20
Joined
May 2, 2010
Messages
219
Office 365

Hi,
I would really like to be able to view google calendar events on a form, probably a schedule list of a few dates.

Tried webbrowser control but lost of script errors but not persisted as not sure this would be quite right for me anyway.

What does look ideal is embedded code.
Google calendar settings shows lots of options & this is customizable & I end up with this iFrame code.
Is there a way to show below in webbrowser control.

<iframe src="https://calendar.google.com/calendar/embed?height=600&wkst=1&bgcolor=%23FFFFFF&src=vcneucxxxxxxxxxxxxxxxgjs62k%40group.calendar.google.com&color=%238D6F47&ctz=Europe%2FLondon" style="border-width:0" width="800" height="600" frameborder="0" scrolling="no"></iframe>


Ideally I would like to simply import the actual data into a table & show on a form of my own, but looked at this and really complicated, ID's & tokens etc. & I do not need to change or post calendar events (would be nice though)

(changed the src as not sure if personal)

thanks I/A
 

theDBguy

I’m here to help
Staff member
Local time
Today, 14:20
Joined
Oct 29, 2018
Messages
21,473
Hi,

An iframe is something you would display inside a web page, So, try creating a simple HTML file with your iframe in it and then point your web browser control to that file.

Hope it helps...
 

bignose2

Registered User.
Local time
Today, 22:20
Joined
May 2, 2010
Messages
219
Hi,

Thanks for the advise,

I had sort of tried that but get an error

Script error
Object does not support Property or method 'map'

If I double click the simple html file I created in windows explorer it opens fine in chrome (default) & IE & edge.

htmlFileName = "D:\My Data\Access\output.html"
Forms!Form1.WebBrowser9.Navigate htmlFileName


this is all I put in the html file, was a renamed txt file.

<iframe src="https://calendar.google.com/calendar/embed?height=600&wkst=1&bgcolor=%23FFFFFF& amp;src=vcneucxxxxxxxxxxxxxxxgjs62k%40group.calend ar.google.com&color=%238D6F47&ctz=Europe%2 FLondon" style="border-width:0" width="800" height="600" frameborder="0" scrolling="no"></iframe>

Any idea's?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 14:20
Joined
Oct 29, 2018
Messages
21,473
Hi,

If opening the HTML file by itself works fine, then how about just selecting or assigning it to the web browser control when you add the control to the firm rather than use code to do it?

What was the code you’re using anyway that is getting the “does not support “ error?
 
Last edited:

bignose2

Registered User.
Local time
Today, 22:20
Joined
May 2, 2010
Messages
219
Hi,

Same error if this file is the source.

I guess the WB does not like the iframe code as below.

<iframe src="https://calendar.google.com/calendar/embed?height=600&wkst=1&bgcolor=%23FFFFFF& amp;src=vcneucxxxxxxxxxxxxxxxgjs62k%40group.calend ar.google.com&color=%238D6F47&ctz=Europe%2 FLondon" style="border-width:0" width="800" height="600" frameborder="0" scrolling="no"></iframe>

this is direct from google, embedded code. as I say I have changed the src=

I am begining to think the Access webcontrol simply can handle some of this but I am no expert.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 14:20
Joined
Oct 29, 2018
Messages
21,473
Hi,

The web browser control is not exactly the latest version of IE out there. There are some registry settings you could try to force the control to emulate a different version of IE, but not sure if that will help at all.
 

bignose2

Registered User.
Local time
Today, 22:20
Joined
May 2, 2010
Messages
219
Hi,

just briefly looking at alternative option which if can get work would actually be better for me.

Google has link to iCal, if I point the WB at it is loads & asks to open or save the file. If I save I can open & see all the details & dates I need.
If I can find a way to save this file without any user interaction that would be great, I can manipulate the file & get the details I want.
Prob asking the impossible again as all done inside the WB control.

https://calendar.google.com/calenda...te-472ff944e7fafb9axxxxxxxxxfa19712/basic.ics
 

bignose2

Registered User.
Local time
Today, 22:20
Joined
May 2, 2010
Messages
219
Hi,

That is perfect, thanks very much.

Using the 2nd example I have been able to download the google .ics (secrect one) direct without any interaction.

the line of code: Sleep HTTPREQ_TIMEOUT_CHECK gives a compile error, I have just removed for the moment & investigate later but it works fine without, I assume for some sort of delay but mine works, so far without.

Just coding at the moment to parse the imported data but that should be easy.
This is as I say for me much better than just viewing the calendar in the webbrowser. Having access to the actual data opens up a lot of possibilites for other stuff.

Thanks again & you have obviously given that some thought.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:20
Joined
May 7, 2009
Messages
19,242
you can also use URLDownloadToFile (source: https://stackoverflow.com/questions...ad-a-file-using-vba-without-internet-explorer)
Code:
Declare PtrSafe 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

Sub Example()
    DownloadFile$ = "someFile.ext" 'here the name with extension
    URL$ = "http://some.web.address/" & DownloadFile 'Here is the web address
    LocalFilename$ = "C:\Some\Path" & DownloadFile !OR! CurrentProject.Path & "\" & DownloadFile 'here the drive and download directory
    MsgBox "Download Status : " & URLDownloadToFile(0, URL, LocalFilename, 0, 0) = 0
End Sub
 

bignose2

Registered User.
Local time
Today, 22:20
Joined
May 2, 2010
Messages
219
HI,

Thanks for all the advise

Struggle to get the code recommended in previous reply, to compile, errors, (not sure if needed references as someone mentioned) not going to investigate as have working option already but I'm actually using this code below I found also, just seems cleaner but not sure if any have benefits over one or the other.


Dim myURL As String
myURL = SourceURL ' "https://YourWebSite.com/?your_query_parameters"

Dim WinHttpReq As Object
Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
WinHttpReq.Open "GET", myURL, False ', "username", "password"
WinHttpReq.send

myURL = WinHttpReq.responseBody
If WinHttpReq.Status = 200 Then
Set oStream = CreateObject("ADODB.Stream")
oStream.Open
oStream.Type = 1
oStream.Write WinHttpReq.responseBody
oStream.SaveToFile DestinationFile, 2 ' 1 = no overwrite, 2 = overwrite
oStream.Close
End If

Parsing the iCal to usable fields easy enough but bit long winded.


thanks again.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 14:20
Joined
Oct 29, 2018
Messages
21,473
Hi,

Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom