Clearing Text on Certain Dates in VB - vb.net

Ok, so I am working on the very last part of my program and I am wondering if this is possible in VB and how to do it. I was thinking it was probably going to turn into a big If Statement, but I am not sure on the code to be exact.
Basically what I am trying to do is have my program write a new line of text into a .txt file once a day, I got that going good, but now what I want the program to do is to clear the entire .txt file at the start of each month, while also writing to the .txt file after the clear on the same day.
Is this possible? If so, could I get some help on this? Thank you!

Seems to me that it's as simple as this:
If Date.Now.Date.Day = 1 Then
File.Create(Path).Close() ' replace with your path to the file
End If

Related

Fortran formatting output

Let's say I need to write a vector of 100 elements in column form to .txt file.
Then I generated another vector of 100 values. How can I open that file, write the new vector next to the old one, and close it?
Can someone give me guidance on formatting output files like a pro?
Thank you so much.

Vb.net What is the best way to parse a txt file that gets updated

what I need to accomplish: I need to read a text file that gets updated every 10 sec and dump the new data into. I need to find the best way to do this. I've tried streamreader and file.readalllines, I can get the contents of the txt file, but I don't know how to compare and dump the added lines. Any input would be appreciated, thank you.
Under the assumptions that this is a log file you're reading, where the data is being appended to end, and you're reading the file every 10 seconds, why don't you keep track of the number of lines read or the last line number from the last read?
You can then check to see whether the current read has exceeded the previous line number or number of lines read. If it has exceeded, you should be able to work out what the new lines were added because you know where you read until previously. You can read from the (previous read line + 1) until the end of file.

VBA Word original text on revised range on readonly files

I am creating a VBA tool to record (for QA purposes) revisions of translated files.
I can read both original and revised text, whitch I do paragraph by paragraph.
But I run into problems every time the file cannot be written to (open by someone else or wasn't closed correctly).
Since the macro will run for a long time, this is an issue. I could work around it, but my client probably will not be able to follow the procedure.
Is there no way to just read the original text without having to modify the file?
It really feels that there should be a way. I serache for a way to copy the range into a dummy and then rever revisions on that new one, but no such luck.
I'm really just doing
set wrdApp=CreateObject("Word.Application")
set wrdDoc=wrdApp.Documents.Open(filePath)
for each par in wrdDoc.Paragraphs
if par.Range.Revisions.Count <> 0 then
dim original, revised as String
revised=par.Range.Text
par.Range.Revisions.RejectAll
original=par.Range.Text
ProcessRevision original, revised
End if
next
Thanks!
Answering it myself, bottom line is it can't be done. I run into some other issues and had to undo changes after rejecting revisions, but I still can't do it unless I have write permissions.
My solution to make sure the files were not open somewhere was to copy the files prior to reading.
It's frustrating that a clearly read operation (getting the original text) need write permission.
If I ever find another solution, I'll be sure to post here.

Edit multiple Excel workbooks in folder

I have a couple hundred CSV files I need to do the same edits to.
-I need to change one column from scientific notation to a number without and decimals
-If a cell in specific column begins with '2014', delete entire row
-Save as new file name, from 'filename.csv' to 'filename_new.csv'
I tried using Kutools for Excel but couldn't figure out if I could edit multiple books
Could someone help me out with this? I appreciate the help. Thanks.
Workbooks.Open "YourFilePath" will let you open a single file (don't forget that you'll probably need to store the workbook in a variable so you can better address it).
You can then do whatever edit you like, for example your YourSheet.Cells(x,y).EntireRow.Delete under an If condition.
You can then .Close your Workbook and specify a filename to save.
Matt, I'm sorry but I can just provide you some ideas. Writing the code won't help you learn :)

SQL developer Import data wizard comes up blank

So I have a file that has over 100 entries in it as an excel worksheet. I want to put those over into a sql. So I fire up my sql developer and try and import the data but it doesn't show up.
The next and finish buttons don't do anything. (the blue underline words aren't links to anything either fyi)
Have you tried converting the original file to text (csv) then importing? That has worked for me in the past.
I had the same problem and the only way to get rid of it was to rename the preferences folder (as described here: https://www.thatjeffsmith.com/archive/2015/08/how-to-reset-your-sql-developer-preferencessettings/) and start the program with factory defaults.
One more reason is that the CSV or excel file is of 0 kb size or empty.