Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help needed for "Output to file"

Status
Not open for further replies.

maththetraveller

Technical User
Mar 29, 2008
6
US
Hi! What i'm trying to do is to track a specific data in a simple .txt file everytime a user clicks on a specific macro and performs the action. What i can't figure out is how to tell the macro to go to the last line of the file before it prints the data. My code looks like this:

Reason = XREASON & XLETTERSENT
Open "C:\tempdata\Tracking.txt" For Output As #1
Print #1, Reason
Close
 
Append Indicates sequential
output mode. Append
sets the file pointer to
the end of the file so
that subsequent Print
# or Write #
statements, in effect,
are appended to
filename$.
Code:
 Reason = XREASON & XLETTERSENT
   Open "C:\tempdata\Tracking.txt" For [COLOR=red]Append[/color] As #1
   Print #1, Reason
   Close

[small]Sometimes you gotta leave your zone of safety. You have to manufacture Inspirado. You gotta get out of the apartment. You've got to run with the wolves. You've got to dive into the ocean and fight with the sharks. Or just treat yourself to a delicious hot fudge sundae........ with nuts. - Jack Black[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top