Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-29-2015, 11:18 AM
charlesdh charlesdh is offline Append to Existing file Windows 7 32bit Append to Existing file Office 2010 32bit
Expert
Append to Existing file
 
Join Date: Apr 2014
Location: Mississippi
Posts: 382
charlesdh is on a distinguished road
Default

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?
Reply With Quote
 



Similar Threads
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
Append to Existing file How to append specific *.tif image with another tif file through Word VBA 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

Other Forums: Access Forums

All times are GMT -7. The time now is 02:55 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft