I Worksheet_Change lägger du följande kod:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1")) Is Nothing Then
Exit Sub
End If
Call CreateTextFile(Target)
End Sub
Skapa sedan en modul där du lägger följande kod:
Public Sub CreateTextFile(ByVal strTxtIn As String)
Dim strDestination As String
Dim strFileName As String
Dim fnum As Integer
strDestination = ThisWorkbook.Path & Application.PathSeparator
strFileName = strTxtIn
strFileName = strDestination & strFileName & ".txt"
fnum = FreeFile()
Open strFileName For Output As fnum
Print #fnum, "WEB"
Print #fnum, "1"
Print #fnum, "http://weblink.solar.se/SGS/Catalog/product/productdetails.aspx?&ArtNo=" & strTxtIn
Print #fnum, vbCrLf
Print #fnum, "Selection=EntirePage"
Print #fnum, "Formatting=None"
Print #fnum, "PreFormattedTextToColumns=True"
Print #fnum, "ConsecutiveDelimitersAsOne=True"
Print #fnum, "SingleBlockTextImport=False"
Print #fnum, "DisableDateRecognition=False"
Print #fnum, "DisableRedirections=False"
Close #fnum
End Sub
Skapar en textfil med namn efter det som lagts in i A1 varje gång A1 ändrats. Det bör efter lite anpassning fungera väl.