Im trying to create a macro in excel that creates a text file which some of the parameters are on excel cells.
The output would be for example:
The kid is 'cell (1,1)' old.
His name is 'cell (1,2)'.
I managed already to create the file but Im straggling to add the variable in the middle of the text. Follow bellow the code that I have written:
Sub Generate_KML()
Dim strPath As String
Dim iFileNumber As Long
Dim strHeader As String
Dim strData As String
strPath = Application.GetSaveAsFilename(FileFilter:= _
"KML File (*.kml), *.kml", Title:="Save Location")
iFileNumber = FreeFile()
strHeader = ActiveCell.Offset(1, 1)
strData = "Test 2"
Open strPath For Output As #iFileNumber
Print #iFileNumber, strHeader
Print #iFileNumber, strData
Close #iFileNumber
End Sub
Thank you! Regards, Richard Lima