Friday, July 31, 2009

VB Macros : Extract out filename

To extract the file name use the following code :

Dim fileName As String
Dim Location As Integer

fileName= ActiveDesignFile.Name
Location = InStrRev(fileName, ".", -1)
fileName = Mid(fileName, 1, Location - 1)

Now What this code will do is that it will extreact out the name of the file for eample if the file name is "example.txt" it will return you "example" int the string fileName

No comments:

Post a Comment