This code will write log file to LogFilePath, and generate output as below. StarRange and EndRange is a variable which value will populate from other function.
"Start postion",A1 "End position",B100 ---Code----------------- Sub WriteLogFile() Dim FilePath As String LogFilePath = WriteTextBox.Text LogFilePath = LogFilePath & ".log" Open LogFilePath For Output As #2 Write #2, "Start postion"; StarRange Write #2, "End position"; EndRange Close #2 MsgBox FinalFileName End Sub
My question is how can I remove double quotation mark from output and produce output as below. Thanks
Start position = A1 End position = B100
Cells. Replace What:="", Replacement:="", LookAt:=xlPart, MatchCase:=False 'Replaces the quotes.
Option 1: Remove any double quotes in a text string with replace('my string','"',''). This will substitute any instance of a double quote anywhere in the string with an empty string.
To remove double quotes just from the beginning and end of the String, we can use a more specific regular expression: String result = input. replaceAll("^\"|\"$", ""); After executing this example, occurrences of double quotes at the beginning or at end of the String will be replaced by empty strings.
Write
is a special statement designed to generate machine-readable files that are later consumed with Input
.
Use Print
to avoid any fiddling with data.
Print #2, "Start postion = "; StarRange Print #2, "End position = "; EndRange
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With