Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 93 lines (62 sloc) 2.705 kB
71cb477 @emilefyon Update of filenames
authored
1 Attribute VB_Name = "LIB_String"
2 '---------------------------------------------------------------------------------------------------------------------------------------------
3 '
4 ' File Library v0.1
5 '
6 '
7 ' Functions lists
8 ' ---------------
9 '
10 ' + Function writeFile (ByVal file As String, ByVal content As String) As String : overwrite the content specified in the file specified.
11 ' * Specifications / limitations
12 ' - If the file does not exists, the file is created
13 ' - The folder has to exist
14 ' * Arguments
15 ' - file as String : the full path of the file
16 ' - content as String : the content that has to be written into the file
17 '
18 '
19 ' Revisions history
20 ' -----------------
21 ' - Emile Fyon 11/07/2012 v0.1 Creation
22 '
23 '---------------------------------------------------------------------------------------------------------------------------------------------
24
25
26
27
28
29
30 '---------------------------------------------------------------------------------------------------------------------------------------------
31 ' + implode (ByVal cellRange As Range, ByVal delimiter As String, Optional ignoreBlank As Boolean) :
32 ' * Specifications / limitations
33 ' -
34 ' * Arguments
35 ' -
36 '
37 ' Last edition date : 24/08/2012
38 '
39 ' Revisions history
40 ' -----------------
41 ' - Emile Fyon 11/07/2012 Creation
42 ' - Emile Fyon 24/08/2012 Corrected delimiter bug
43 '
44 '---------------------------------------------------------------------------------------------------------------------------------------------
45
46
47 Function implode(ByVal cellRange As Range, ByVal delimiter As String, Optional ignoreBlank As Boolean)
48
49 If IsMissing(ignoreBlank) Then ignoreBlank = False
50
51 newText = ""
52 For Each c In cellRange
53 If c.Value = "" And ignoreBlank = True Then
54
55 Else
56 newText = newText & c.Value & delimiter
57 End If
58 Next
59 newText = Left(newText, Len(newText) - Len(delimiter))
60
61 implode = newText
62
63
64
65 End Function
66
67
68 Function protectForSQL(text As String, Optional ByVal isNumber As Boolean) As String
69
70 If IsMissing(isNumber) Then isNumber = False
71
72
73 text = Replace(text, "€", "€")
74 text = Replace(text, "'", "''")
75
76 If isNumber Then text = Replace(text, ",", ".")
77
78 protectForSQL = text
79
80 End Function
81
82
83
84 Function deleteCharReturns(ByVal txt As String) As String
85
86 txt = Replace(txt, Chr(13), "")
87 txt = Replace(txt, Chr(10), "")
88
89 deleteCharReturns = txt
90
91 End Function
92
Something went wrong with that request. Please try again.