Adding variable to a txt file

Hi everyone I need some help for a vba code

Today i'm trying out something, but i can't manage to make it work

I'm tryind to add a variable to a text file in a middle of a sentence but i don't know how to do so.

here is the code :

Sub création_de_fichier_flvar()

Dim Sentence As String
Dim Sentence2 As String
Dim Sentence3 As String
Dim DerniereLigne As Integer
Dim A As Object
Dim B As Worksheet
Dim n As Object
Dim x As Integer
Const Doublequote  As String = """"

Set B = Worksheets("MDR")
Set n = CreateObject("Scripting.FileSystemObject")
Set A = n.CreateTextFile("C:\Users\F589975\Desktop\Liste_Outillage.flvar", True)

DerniereLigne = B.Range("B65536").End(xlUp).Row

A.WriteLine ("<?xml version=""1.0\"" encoding=\""utf-8""?>")
A.WriteLine ("<CatapultVariableSet conditions="""">")

If B.Range("A1") = "référence" Then
    For x = 2 To DerniereLigne

        B.Cells(x, 1).Value = Sentence
        A.WriteLine ("<Variable Name="" & ""  Reference = ""a"" Comment=""a"">A</Variable>")
    Next

End If
    A.Close
End Sub

The variable is : Sentence, wich is supposed to be a number/or a string but in the txt file it returns me : Sentence in place of the number/string

I don't know if it's clear, But thanks in advance for your help

Search for threads similar to "adding variable txt file"