Permalink
Browse files

Update of filenames

The filenames were not compatible with Office 2003. Added a prefix LIB_
  • Loading branch information...
1 parent a2c9da5 commit 71cb4772052522331e77da2747e339642b7b4f88 @emilefyon committed Aug 27, 2012
View
@@ -1,124 +0,0 @@
-Attribute VB_Name = "Folder"
-'---------------------------------------------------------------------------------------------------------------------------------------------
-'
-' FoldersFiles Library v0.1
-'
-'
-' Functions lists
-' ---------------
-'
-' + Function writeFile (ByVal file As String, ByVal content As String) As String : overwrite the content specified in the file specified.
-' * Specifications / limitations
-' - If the file does not exists, the file is created
-' - The folder has to exist
-' * Arguments
-' - file as String : the full path of the file
-' - content as String : the content that has to be written into the file
-'
-' + Function readFile(ByVal file As String) As String : read the content of a file and return a single line with all the content
-' * Specifications / limitations
-' - The file has to Exists, no error handling
-' - The content is retrieved without any line returns (line returns are replaced by space)
-' * Arguments
-' - file as String : the full path of the file
-' + Function readFileAndTruncate(ByVal file As String) As String : calls readFile() and then truncate the text to 30000 characters in order to avoid Excel limitations
-' * Specifications / limitations
-' - The file has to Exists, no error handling
-' - The content is retrieved without any line returns (line returns are replaced by space)
-' - Only the 30.000 first characters are retrieved
-' * Arguments
-' - file as String : the full path of the file
-'
-' Revisions history
-' -----------------
-' - Emile Fyon 11/07/2012 v0.1 Creation
-'
-'---------------------------------------------------------------------------------------------------------------------------------------------
-
-
-
-
-
-'---------------------------------------------------------------------------------------------------------------------------------------------
-' + ListFiles(ByVal strPath As String, ByVal cellDestination As Range)
-' * Description : List the files in the folder specified in argument and display the list of the files in the cells
-' below the cell given in argument as well as the full path in the right column
-'
-' * Specifications / limitations
-' - Has to be launched by an other macro
-' * Arguments
-' - strPath as String : the full path of the folder
-' - cellDestination as Range : the destination cell
-'
-' Last edition date : 11/07/2012
-'
-' Revisions history
-' -----------------
-' - Emile Fyon 11/07/2012 Creation
-'
-'---------------------------------------------------------------------------------------------------------------------------------------------
-
-
-
-Sub ListFiles(ByVal strPath As String, ByVal cellDestination As Range)
-
- ' Local variables
- Dim counter As Integer
- Dim File As String
- ' Dim filesTab
-
- ' Add a trailing slash if needed
- strPath = checkFolder(strPath)
-
- File = Dir$(strPath & Extention)
-
- ' Count the number of files in the folder
- Do While Len(File)
- File = Dir$
- counter = counter + 1
- Loop
- ReDim filesTab(counter - 1)
- counter = 0
-
- ' Reset the counter of the array
- File = Dir$(strPath & Extention)
-
- ' List the files and display them in the cells
- Do While Len(File) And counter <= UBound(filesTab)
- cellDestination.Offset(counter, 0) = File
- cellDestination.Offset(counter, 1) = strPath & File
- File = Dir$
- counter = counter + 1
- Loop
-
-
-
-End Sub
-
-
-'---------------------------------------------------------------------------------------------------------------------------------------------
-' + checkFolder(ByVal strPath As String) As String
-' * Description : check that the folder has a trailing slash and add one if needed
-'
-' * Specifications / limitations
-' - Should be nice to create the folder (and parent folders) if it does not exists
-' * Arguments
-' - strPath as String : the full path of the folder
-'
-' Last edition date : 11/07/2012
-'
-' Revisions history
-' -----------------
-' - Emile Fyon 11/07/2012 Creation
-'
-'---------------------------------------------------------------------------------------------------------------------------------------------
-
-
-Function checkFolder(ByVal strPath As String) As String
-
- ' Add a trailing slash if needed
- If Right$(strPath, 1) <> "\" Then strPath = strPath & "\"
- checkFolder = strPath
-
-End Function
-
@@ -1,127 +1,127 @@
-Attribute VB_Name = "ConvertTextToNumber"
-
-Sub run()
-
- For Each cell In Selection
- If cell.Value <> "" Then Call ConvertTextToNumber(cell)
- Next
-
-End Sub
-
-Sub run_WithDecimals()
-
- For Each cell In Selection
- If cell.Value <> "" Then Call ConvertTextToNumber_WithDecimals(cell)
- Next
-
-End Sub
-
-
-Sub ConvertTextToNumber(ByVal cell As Range)
-
- cell.Value = convertTextToNumber_GetCurrentDisplay(cell)
- cell.Value = convertTextToNumber_DashToZero(cell)
- cell.Value = convertTextToNumber_DeleteSeparators(cell.Value)
- cell.Value = convertTextToNumber_Parenthesis(cell.Value)
- cell.Value = convertTextToNumber_AddDecimals(cell.Value)
- cell.NumberFormat = "#,##0.00"
-
-End Sub
-
-Sub ConvertTextToNumber_WithDecimals(ByVal cell As Range)
-
- decimals = convertTextToNumber_CountDecimals(cell)
- cell.Value = convertTextToNumber_GetCurrentDisplay(cell)
- cell.Value = convertTextToNumber_DashToZero(cell)
- cell.Value = convertTextToNumber_DeleteSeparators(cell.Value)
- cell.Value = convertTextToNumber_Parenthesis(cell.Value)
- cell.Value = convertTextToNumber_AddDecimals(cell.Value, decimals)
- cell.NumberFormat = "#,##0.00"
-
-End Sub
-
-Function convertTextToNumber_CountDecimals(ByVal cell As Range) As Integer
-
- Dim regexMask As String
- Dim sepDecimal As String
- Dim val As String
-
- val = convertTextToNumber_GetCurrentDisplay(cell)
- regexMask = "([0-9\.,]+)"
- sepDecimal = "."
-
- val = findExpreg(val, regexMask)
- If InStr(val, sepDecimal) <> 0 Then
- convertTextToNumber_CountDecimals = Len(val) - InStr(val, sepDecimal)
- Else
- convertTextToNumber_CountDecimals = 0
- End If
-
-
-
-End Function
-
-Function convertTextToNumber_GetCurrentDisplay(ByVal cell As Range) As String
-
- convertTextToNumber_GetCurrentDisplay = WorksheetFunction.Text(cell.Value, cell.NumberFormat)
-
-End Function
-
-Function convertTextToNumber_DashToZero(ByVal val As String) As Double
-
- If val = "-" Or val = "--" Then val = 0
- convertTextToNumber_DashToZero = val
-
-
-End Function
-
-Function convertTextToNumber_Parenthesis(ByVal val As String) As Double
-
- Dim regexMask As String
-
- sepDecimal = Application.DecimalSeparator
- regexMask = ".*?\(([0-9" + sepDecimal + "]+)\).*"
- If (findExpreg(val, regexMask)) Then val = -CDbl(findExpreg(val, regexMask))
-
- convertTextToNumber_Parenthesis = val
-
-End Function
-
-
-Function convertTextToNumber_DeleteSeparators(ByVal val As String) As String
-
- val = Replace(val, ".", "")
- val = Replace(val, ",", "")
- convertTextToNumber_DeleteSeparators = val
-
-End Function
-
-Function convertTextToNumber_AddDecimals(ByVal val As Double, Optional ByVal numberDecimals As Variant) As Double
-
- If IsMissing(numberDecimals) Then numberDecimals = 0
-
- convertTextToNumber_AddDecimals = val / 10 ^ numberDecimals
-
-End Function
-
-
-Sub convertDecimalSeparator()
-
- sepDecimal = Application.DecimalSeparator
- Application.DecimalSeparator = "."
- Application.DecimalSeparator = sepDecimal
-
-End Sub
-
-
-Sub ChangeSystemSeparators()
-
- Range("A1").Formula = "1,234,567.89"
- MsgBox "The system separators will now change."
-
- ' Define separators and apply.
- Application.DecimalSeparator = ","
- Application.ThousandsSeparator = "."
- Application.UseSystemSeparators = False
-
-End Sub
+Attribute VB_Name = "ConvertTextToNumber"
+
+Sub run()
+
+ For Each cell In Selection
+ If cell.Value <> "" Then Call ConvertTextToNumber(cell)
+ Next
+
+End Sub
+
+Sub run_WithDecimals()
+
+ For Each cell In Selection
+ If cell.Value <> "" Then Call ConvertTextToNumber_WithDecimals(cell)
+ Next
+
+End Sub
+
+
+Sub ConvertTextToNumber(ByVal cell As Range)
+
+ cell.Value = convertTextToNumber_GetCurrentDisplay(cell)
+ cell.Value = convertTextToNumber_DashToZero(cell)
+ cell.Value = convertTextToNumber_DeleteSeparators(cell.Value)
+ cell.Value = convertTextToNumber_Parenthesis(cell.Value)
+ cell.Value = convertTextToNumber_AddDecimals(cell.Value)
+ cell.NumberFormat = "#,##0.00"
+
+End Sub
+
+Sub ConvertTextToNumber_WithDecimals(ByVal cell As Range)
+
+ decimals = convertTextToNumber_CountDecimals(cell)
+ cell.Value = convertTextToNumber_GetCurrentDisplay(cell)
+ cell.Value = convertTextToNumber_DashToZero(cell)
+ cell.Value = convertTextToNumber_DeleteSeparators(cell.Value)
+ cell.Value = convertTextToNumber_Parenthesis(cell.Value)
+ cell.Value = convertTextToNumber_AddDecimals(cell.Value, decimals)
+ cell.NumberFormat = "#,##0.00"
+
+End Sub
+
+Function convertTextToNumber_CountDecimals(ByVal cell As Range) As Integer
+
+ Dim regexMask As String
+ Dim sepDecimal As String
+ Dim val As String
+
+ val = convertTextToNumber_GetCurrentDisplay(cell)
+ regexMask = "([0-9\.,]+)"
+ sepDecimal = "."
+
+ val = findExpreg(val, regexMask)
+ If InStr(val, sepDecimal) <> 0 Then
+ convertTextToNumber_CountDecimals = Len(val) - InStr(val, sepDecimal)
+ Else
+ convertTextToNumber_CountDecimals = 0
+ End If
+
+
+
+End Function
+
+Function convertTextToNumber_GetCurrentDisplay(ByVal cell As Range) As String
+
+ convertTextToNumber_GetCurrentDisplay = WorksheetFunction.Text(cell.Value, cell.NumberFormat)
+
+End Function
+
+Function convertTextToNumber_DashToZero(ByVal val As String) As Double
+
+ If val = "-" Or val = "--" Then val = 0
+ convertTextToNumber_DashToZero = val
+
+
+End Function
+
+Function convertTextToNumber_Parenthesis(ByVal val As String) As Double
+
+ Dim regexMask As String
+
+ sepDecimal = Application.DecimalSeparator
+ regexMask = ".*?\(([0-9" + sepDecimal + "]+)\).*"
+ If (findExpreg(val, regexMask)) Then val = -CDbl(findExpreg(val, regexMask))
+
+ convertTextToNumber_Parenthesis = val
+
+End Function
+
+
+Function convertTextToNumber_DeleteSeparators(ByVal val As String) As String
+
+ val = Replace(val, ".", "")
+ val = Replace(val, ",", "")
+ convertTextToNumber_DeleteSeparators = val
+
+End Function
+
+Function convertTextToNumber_AddDecimals(ByVal val As Double, Optional ByVal numberDecimals As Variant) As Double
+
+ If IsMissing(numberDecimals) Then numberDecimals = 0
+
+ convertTextToNumber_AddDecimals = val / 10 ^ numberDecimals
+
+End Function
+
+
+Sub convertDecimalSeparator()
+
+ sepDecimal = Application.DecimalSeparator
+ Application.DecimalSeparator = "."
+ Application.DecimalSeparator = sepDecimal
+
+End Sub
+
+
+Sub ChangeSystemSeparators()
+
+ Range("A1").Formula = "1,234,567.89"
+ MsgBox "The system separators will now change."
+
+ ' Define separators and apply.
+ Application.DecimalSeparator = ","
+ Application.ThousandsSeparator = "."
+ Application.UseSystemSeparators = False
+
+End Sub
Oops, something went wrong.

0 comments on commit 71cb477

Please sign in to comment.