Writing text file

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

When I write a string in a text file using below code my strings are
enclosed in double quotes. How can I avoid the quotes and get just the text?

Thanks

Regards

St = "My String"
Open "MyFile.txt" For Append As #1
Write #1, St
Close #1
 
Use Print method instead:

St = "My String"
Open "MyFile.txt" For Append As #1
Print #1, St
Close #1
 
Hi

When I write a string in a text file using below code my strings are
enclosed in double quotes. How can I avoid the quotes and get just the text?

Thanks

Regards

St = "My String"
Open "MyFile.txt" For Append As #1
Write #1, St
Close #1

Use Print #1 instead of Write #1. See the VBA help for the two methods.
 
Hi

When I write a string in a text file using below code my strings
are enclosed in double quotes. How can I avoid the quotes and get
just the text?

Thanks

Regards

St = "My String"
Open "MyFile.txt" For Append As #1
Write #1, St
Close #1

Try Print #1, st instead of write.
 
Back
Top