Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-14-2022, 03:01 PM
Mel Turco Mel Turco is offline VBA PPT: Read then overwrite specific line in TXT file Windows 10 VBA PPT: Read then overwrite specific line in TXT file Office 2019
Novice
VBA PPT: Read then overwrite specific line in TXT file
 
Join Date: Dec 2021
Posts: 1
Mel Turco is on a distinguished road
Question VBA PPT: Read then overwrite specific line in TXT file

Hello. I'm sorry I have no code to offer for this because the solutions I came up with and those I found from searching seemed unworkable for my specific need. I've worked with creating text files; appending them; and reading them in VBA but can't get how to write over a specific line in one. The more I read about it, the more confused I'm getting. Help, please. Thanks.





I have a txt file, "C:\Activity.txt" with the following content:


=========================
1/12/2022
3
2/4/2022
7
2/10/2022
=========================


Based on a choice they made, code captures it within an IF/THEN routine where I need to read/write to that text file...


If sType = "regular" then
'Read line #2
'Add 1 to that value
'Overwrite that new value back as line #2
'Overwrite line #3 as today's date
'Save it back as the same file.
Elseif sType = "special" then
'Read line #4
'Add 1 to that value
'Overwrite that new value back as line #4
'Overwrite line #5 as today's date
'Save it back as the same file.
End If



Any help is greatly appreciated!!



-Mel Turco
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA PPT: Read then overwrite specific line in TXT file Rename Files in a Folder and Overwrite if File Exists Jayay159 Word VBA 3 10-20-2021 11:48 PM
Error Handler If User Does Not Want to Overwrite File ChrisOK Excel Programming 4 04-03-2020 08:31 PM
VBA PPT: Read then overwrite specific line in TXT file After a specific file is closed, Excel asks again if I want to close the same file -- and ruins it HGilbert Excel 1 01-24-2017 08:37 AM
VBA PPT: Read then overwrite specific line in TXT file Read only file NienkeG Word 2 08-03-2014 03:57 PM
Word does not ask do i want to overwrite a file on saving a file sam2149 Word 2 03-24-2014 04:18 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:46 PM.


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