Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 905
Default How to overwrite data in file?

I am using a text file to log progress of a long-running macro.

I want to continuously overwrite the first line with variable-length data.

The following paradigm demonstrates my problem:

Open myPath For Output Access Write As #fd
Print #fd, "1234567890123456789012345678901234567890"
Seek #fd, 1
Print #fd, "abcde"
Close #fd

I want the file to contain only "abcde". But the actual result is:

abcde
890123456789012345678901234567890

Apparently, "abcde" CRLF overwrote the data, but that did not cause the
end-of-file to be rewritten.

How can I cause the end-of-file to be rewritten?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel File Overwrite GradAsh10 Excel Discussion (Misc queries) 1 January 18th 10 04:13 PM
accidental file overwrite drumjam Excel Discussion (Misc queries) 1 December 31st 08 07:37 AM
how to save a file and overwrite existing file Daniel M Excel Programming 1 January 18th 08 07:45 PM
Prevent PivotTable Overwrite Warning and Disallow Overwrite jonahviakeyboard Excel Programming 0 November 27th 07 05:08 PM
automatic overwrite file S.E. Excel Programming 2 September 11th 04 03:54 AM


All times are GMT +1. The time now is 09:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"