Excel Increment Problem
I have got a really enoying problem with increment a number out of a text file into excel and use this number to send it as a number in the subject of an email.
Here is my code:
Private Sub LOV_Click()
If MsgBox("Send it?", vbOKCancel) = vbOK Then
Application.CutCopyMode = False
ActiveWorkbook.SaveAs FileName:="C:\LOV.xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
ActiveWorkbook.SendMail Recipients:="email@example.com", _
Subject:="Something" & "-" & Range("C1").Value & "-" & "IncrementNr" & "-" & "LOV"
Dim KillFile As String
KillFile = "c:\LOV.xls"
If Len(Dir$(KillFile)) > 0 Then
SetAttr KillFile, vbNormal
The thing is, to differntiate between the excel files, the users are going to send to me, i would like to make use of a txt.file from which excel is getting a specified number e.g. user1 is sending this file, excel looks in the txt file before sending, excel sees that the number is for example 5, excel writes number 6 into the txt file, and uses it in the subject, so that I know which of the excel files are the newest. It doesn't matter if two Users are working at the same time with the excel file. User2 would increment number 7 and send the number 7 in the subject of the email. Puuhh....hard work, isn't it? It is no problem to implement a number from Excel into the subject for me. but what can I do to tell excel to read the txt file than increment the number in the text file, take that number and copy it to specified range in the excel sheet to "vba" it into the subject?
How can I do this? Any reply is greatly appreciated!!