Hi,
In the code below I'm attempting to append data from existing bookmarks.
When I run the code I can see the data in each bookmark. But, when I use the bookmark info it does not populate the existing file "log.txt".
But, when I assign the the data it will populate the file "log.txt".
Can someone tell me what I'm doing wrong?
Code:
Sub Test_BookMark_Append()
Dim filenr As Long
Dim Fname As Variant
Dim Lname As Variant
Dim Mage As String
Dim mypath
filenr = FreeFile
'Fname = ThisDocument.Bookmarks("FirstName").Range.Text' not working
'Lname = ThisDocument.Bookmarks("LastName").Range.Text' not working
'Mage = ThisDocument.Bookmarks("Mage").Range.Text' not working
Lname = "Sam"'''' works
Fname = "Dootie"'''' works
Mage = "70"'''' works
mypath = ThisDocument.Path & "\log.txt"
Open mypath For Append As #filenr
Print #filenr, Fname & "," & Lname & "," & Mage
Close #filenr
End Sub
Opp's I posted this at
http://www.mrexcel.com/forum/excel-q...-document.html
And
http://forums.techguy.org/business-a...ting-file.html
Sorry!
When using the bookmarks for some reason when appending to existing file creates a new row. How can I stop it?