Wednesday, August 5, 2009
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
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
VB Macros : Code to convert String to Byte Array
Use StrConv function with "vbFromUniCode" to convert a VB String to a byte array of ANSI Charecters
Here is the Code
Dim srcString As String
Dim destArr() As Byte
secString = ActiveDesignFile.Name ' You can place any string here
destArr = StrConv(srcString, vbFormUniCode)
What this will do is that it will take your string, convert each charecter to ANSI, and store it in the designated array.
Here is the Code
Dim srcString As String
Dim destArr() As Byte
secString = ActiveDesignFile.Name ' You can place any string here
destArr = StrConv(srcString, vbFormUniCode)
What this will do is that it will take your string, convert each charecter to ANSI, and store it in the designated array.
Subscribe to:
Posts (Atom)