Have a loot at the format() function, use that to build up your filename. Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
Create a form with two text boxes (Text1 and Text2) plus
a button (Command1) - I put a lot of thought into those names :>} Type a filename into Text1 and click the button.
NOTE: the code assumes a DOT between the prefix and suffix in the filename.
The code is tested and works.
Put this code on the button click event
=====================================
Private Sub Command1_Click()
If Not IsNull(Text1.Text) Then
Text2 = AddDateToFileName(Text1.Text)
End If
End Sub
Function AddDateToFileName(FileNameIn As String) As String
Dim intPos As Integer
intPos = InStr(FileNameIn, "."
Oopse, I forgot to give him a path, but then he did not ask for one, just the file name.
So I assumed he knew where he was putting it. They never have to knock if your door is always open.
the file ends up where ever i run thre program from. For now that is what i needed. I can now play with figuring out how to add the path. I have to do some of the work....
I put all of my paths in an ini file. That way I don't ever have to recompile my program to change a path.
Some people put their paths in the registry. That's ok, but you have a much easer time editing an ini file with notepad.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.