Ask Your Question
0

Is there a WebBrowser object similar to VBA in excel?

asked 2019-01-28 04:52:47 +0100

jmcsys gravatar image

updated 2019-01-29 19:31:51 +0100

The below code opens IE inside excel. Column A has URL's in them and when I click a URL they are displayed in the embedded IE browser. Is there a way to do this in calc on linux? Thanks!

Dim WithEvents ie As WebBrowser

Private Sub CommandButton1_Click()

WebBrowser1.Document.body.Scroll = "no"

Dim site As String

site = Sheets("New").Range("A" & Range("E1").Value).Value

WebBrowser1.Navigate (site)

End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Selection.Count = 1 Then

    If Not Intersect(Target, Range("A:A")) Is Nothing Then

        'MsgBox Target.Value

        WebBrowser1.Navigate (Target.Value)

    End If

End If

End Sub

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-02-01 06:01:15 +0100

echo8hink gravatar image

In my experience it is actually harder NOT to get a link opened in the default browser using LO Calc in Linux.

If I enter a web address like "www.libreoffice.org" in A1, it automatically converts to a hyperlink and if I hover the mouse over it the tool tip will tell me to use ctrl-click to go to the link. If I do as it says, my default browser, firefox is launched and the web site is opened in a new window.

If you still need a command button to control this action, various macro solutions are available.

The code you pasted in the question is not working on my windows 10, excel 365 (16). Microsoft deprecated the web browser object in excel sometime around 2016 for security reasons.

Interestingly, LibreOffice in windows will still execute an OLE version of IE per the code in Andrew Pitonyak's OpenOffice Macros book chapter 5.11 here.

There is also the BASIC macro command "shell()" that will run a program such as firefox, and pass command line parameters to it. See the LibreOffice help on BASIC Language reference.

It would seem that the functionality to do what you want to do is available to you in LibreOffice Calc in several ways.

-hink

edit flag offensive delete link more

Comments

Hi Hink,

Thanks for responding. Your response does not answer my question. I already know how to launch an external browser from calc. What I want to do is load an embedded browser in a calc cell. I can do this in excel. This code above does exactly that (it does not launch en external browser).

site = Sheets("New").Range("A" & Range("E1").Value).Value 'loads embedded IE browser. WebBrowser1.Navigate (site)

Do you have any idea how to open en embedded browser inside a calc document?

Also I am running this on debian9 so IE is probably not an option.

Thanks!

jmcsys gravatar imagejmcsys ( 2019-02-01 21:39:27 +0100 )edit

I don't know of any embedded browser for calc/linux. I have seen examples of calc sheets that get data from the web using a cell "linked to external data". I still can't figure out exactly what the VBA code does. It wouldn't run on my laptop with excel. Keep searching. Someone out there will have the answer. This stuff has been around for a long time now. -hink

echo8hink gravatar imageecho8hink ( 2019-02-02 22:36:01 +0100 )edit

Thanks for responding. I made that file back on excel 2007, so it might not work with the current version of excel either. You have to first drop a webbrowser object onto the excel spreadsheet and then ensure its named "Webbrowser1" for it to work correctly. It still works like a charm on my old trusty laptop and office 2010. I will keep looking! -jmcsys

jmcsys gravatar imagejmcsys ( 2019-02-06 05:19:33 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-01-28 04:52:47 +0100

Seen: 104 times

Last updated: Feb 01