Excel フォームからユーザーの方程式をリアルタイムでレンダリングしたいと考えています。テキスト ボックス (TextBox1) と Microsoft Web Browser 要素 (WebBrowser1) を含むフォームを作成しました。jqMath ファイルと同じディレクトリに html ファイル 'eqn.html' が保存されています。私の問題は、テキスト ボックスの値を html ファイルに渡すことでした。
私の洗練されていない解決策は、クエリ文字列を使用することでした。私のVBAは:
Private Sub TextBox1_Change()
WebBrowser1.Navigate2 ("D:\Users\Geddes\Desktop\new graph plotter\mathscribe\eqn.html?" + TextBox1.Value)
End Sub
私の「eqn.html」ファイルは次のとおりです。
<!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>
これで問題はありませんが、テキスト ボックスにすべての文字を入力して html ファイルを再ロードするのは賢明ではないようです。
より良い方法はありますか?