![]() |
KnowBrainer Speech Recognition | ![]() |
Topic Title: Using line break characters like vbNewLine in strings Topic Summary: Created On: 03/05/2022 01:36 PM Status: Post and Reply |
|
![]() |
![]() |
- wristofdoom | - 03/05/2022 01:36 PM |
![]() |
![]() |
- Alan Cantor | - 03/05/2022 03:00 PM |
![]() |
![]() |
- wristofdoom | - 03/05/2022 04:02 PM |
![]() |
![]() |
- Alan Cantor | - 03/05/2022 04:35 PM |
![]() |
![]() |
- noblemd | - 03/05/2022 06:32 PM |
![]() |
![]() |
- wristofdoom | - 03/05/2022 08:06 PM |
![]() |
![]() |
- kkkwj | - 03/10/2022 06:34 PM |
![]() |
|
Hi, The below code works, but it makes use of the clipboard, which is not ideal. Sub Main Dim output1 As String output1 = "testing" & vbNewLine & "testing" Clipboard output1 SendKeys "^v" End Sub
I wanted to do something like this:
Sub Main Dim output1 As String output1 = "testing" & vbNewLine & "testing" SendKeys output1 End Sub
But that gives me an error. Not sure why. So is there a better way to instert this text in a way that does not make use of SendKeys "{enter}" to create the linebreaks, and does not make use of the clipboard? ------------------------- Dragon Professional Individual v15.6. Windows 10. Knowbrainer 2017. |
|
|
|
![]() |
|
I'm not sure why, but you may need to use SendSystemKeys or SendDragonKeys, perhaps something like this:
Sub Main Dim output1 As String output1 = "testing" & Chr(10) & "testing" SendDragonKeys output1 End Sub |
|
|
|
![]() |
|
Thanks. Is Chr(10) better than vbNewline?
------------------------- Dragon Professional Individual v15.6. Windows 10. Knowbrainer 2017. |
|
|
|
![]() |
|
No better. But it works!
|
|
|
|
![]() |
|
In MsgBox, I use: MsgBox "First Line" + Chr$(13) + Chr$(10) + "Second Line" See this about vbNewLine https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualbasic.constants.vbnewline?view=net-6.0
------------------------- Michael Noble
DPI 15.61.200.010 - Windows 11 Pro for Workstations Latest Update / MS Office 2021 LTSC |
|
|
|
![]() |
|
Thanks.
So why the preference for the "Char" format rather than vbCrLf like the documentation suggests?
Also, this is off topic, but regarding your signature, what's the secret to your $30 / 99 percent accuracy microphone situation? ------------------------- Dragon Professional Individual v15.6. Windows 10. Knowbrainer 2017. |
|
|
|
![]() |
|
I would guess that using the Chr$(..) format works for all ASCII characters and so can easily become a habit - treat everything the same way. Having said that, I use vbCrLf when I want that particular combination. It's a matter of personal preference. You can also use the escape sequences in some languages like "\n\r" for newline + return.
------------------------- Win10/11/x64, AMD Ryzen 7 3700X/3950X, 64/128GB RAM, Dragon 15.3, SP 7 Standard, SpeechStart, Office 365, KB 2017, Dragon Capture, Samson Meteor USB Desk Mic, Amazon YUWAKAYI headset, Klim and JUKSTG earbuds with microphones, 3 BenQ 2560x1440 monitors, Microsoft Sculpt Keyboard and fat mouse |
|
|
FuseTalk Standard Edition v4.0 - © 1999-2022 FuseTalk™ Inc. All rights reserved.