> SaveStringAsFile    


Synopsis

VBA to save a string as a file. Open, or create, the specified path\filename. Use Print to set the file content equal to the passed string, psFileContents.

CODE
' SaveStringAsFile
' http://www.utteraccess.com/wiki/SaveStringAsFile
' Code courtesy of UtterAccess Wiki
' Licensed under Creative Commons License
' http://creativecommons.org/licenses/by-sa/3.0/
'
' You are free to use this code in any application,
' provided this notice is left unchanged.
'
' rev  date                          brief descripton
' 1.0  2019-07-16                    
'
'*************** Code Start *****************************************************
' Purpose  : Create (or modify) a file whose contents is a specified string
'---------------------------------------------------------------------------------------
'                              SaveStringAsFile
'---------------------------------------------------------------------------------------
'
Public Sub SaveStringAsFile (psPathFile As String, psFileContents As String)
'160730 s4p
  Dim iFile As Integer
  iFile = FreeFile
  Open psPathFile For Output As iFile
  Print #iFile, psFileContents
  Close iFile
End Sub
'*************** Code End *******************************************************

Creative Commons License
SaveStringAsFile by UtterAccess Wiki is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Editing and revision of the content is freely encouraged; for details, see Expected Usage.