![]() |
#1
|
|||
|
|||
![]()
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 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? |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
import outline into existing file | eNGiNe | PowerPoint | 0 | 02-18-2015 05:56 AM |
new style for append only | thebrin | Word | 0 | 02-03-2015 06:03 PM |
![]() |
aarun2 | Word VBA | 1 | 04-08-2014 03:20 PM |
sending data from UserForm of existing excel file to a new excel file | saltlakebuffalo | Excel Programming | 0 | 02-13-2014 10:55 PM |
adding a pst file to an existing pst file | falcodriver | Outlook | 2 | 12-14-2011 08:16 AM |