2022-09-12, 06:39:00
I'm sorry for your loss Will. That's certainly not something you want to go through. Wish you the best.
About the questions.
We'll continue using window.print() for now, hoping it'll be added soon.
As for the keyboard event. We're currently using it because we're loading a text editor library in the browser. In our program we have certain key presses that can activate functionalities, such as ctrl +s, which saves the text from the editor to our program. However, if you're writing inside the editor, the key presses won't be caught because it's seen as an action inside the browser. Which is why we're catching the keyboard events.
This should be possible if we could execute javascript and directly get the result. Because we then only need to call the document of the editor and define it as a HTMLDocument
(In our new case Edge is async, and we can't find a solution for the code below)
Small code example IE browser:
Dim WithEvents oDoc As HTMLDocument 'Events
Private Sub SetoDoc()
Set oDoc = wb.Document.parentWindow.Eval("editor.document.$") ' Here we get document of the edit area of the editor
End Sub
And when a key get pressed, we do:
Private Sub oDoc_onkeydown()
Select Case oDoc.parentWindow.Event.KeyCode
Case vbKeyS
If oDoc.parentWindow.Event.ctrlKey Then
' Call functions
End If
End Sub
Hopefully this makes our goal a bit clearer.
About the questions.
We'll continue using window.print() for now, hoping it'll be added soon.
As for the keyboard event. We're currently using it because we're loading a text editor library in the browser. In our program we have certain key presses that can activate functionalities, such as ctrl +s, which saves the text from the editor to our program. However, if you're writing inside the editor, the key presses won't be caught because it's seen as an action inside the browser. Which is why we're catching the keyboard events.
This should be possible if we could execute javascript and directly get the result. Because we then only need to call the document of the editor and define it as a HTMLDocument
(In our new case Edge is async, and we can't find a solution for the code below)
Small code example IE browser:
Dim WithEvents oDoc As HTMLDocument 'Events
Private Sub SetoDoc()
Set oDoc = wb.Document.parentWindow.Eval("editor.document.$") ' Here we get document of the edit area of the editor
End Sub
And when a key get pressed, we do:
Private Sub oDoc_onkeydown()
Select Case oDoc.parentWindow.Event.KeyCode
Case vbKeyS
If oDoc.parentWindow.Event.ctrlKey Then
' Call functions
End If
End Sub
Hopefully this makes our goal a bit clearer.