1

I want to render a user's equation in real time from an Excel form. I have created a form with a text box (TextBox1) and a Microsoft Web Browser element (WebBrowser1). I have an html file 'eqn.html' stored in the same directory as the jqMath files. My problem was passing the value of the text box to the html file.

My inelegant solution was to use a query string. My VBA is:

Private Sub TextBox1_Change()

WebBrowser1.Navigate2 ("D:\Users\Geddes\Desktop\new graph plotter\mathscribe\eqn.html?" + TextBox1.Value)

End Sub

and my 'eqn.html' file is:

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">

<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=UnifrakturMaguntia">
<link rel="stylesheet" href="jqmath-0.4.0.css">

<script src="jquery-1.4.3.min.js"></script>
<script src="jqmath-etc-0.4.0.min.js"></script>

</head>
<body>

<script>
var url = window.location.search;
url = url.replace("?", ''); // remove the ?
document.write("$$"+url+"$$");
</script>

</body>
</html>

This does the job but it seems inelegant to re-load the html file with every character typed into the text box.

Is there a better way?

4

0 回答 0