1) Tou are not using "option explicit" at the top of every form, module or class.
If you did vb would let you know you have an undefined variable. You left the "A" out of "Add A BackSlash" inside your function.
2) Properties are defined in classes not modules
3) You do not need a property. Your function can do it all.
4) Unless I am mistaken Excel's Workbook.Path Property always omits the trailing backslash
5) It is a good idea to always declare subs and functions as Public or Prinate. Default is Public but you should still declare it for clarity.
6) Public procedures do not need to be prefixed with the module name.
Public Function AddABackSlash(tcpath As String) As String
tcpath = Trim(tcpath)
If tcpath <> "" Then
If Right(tcpath, 1) <> "\" Then
tcpath = tcpath & "\"
AddABackSlash = tcpath
Private Sub Command1_Click()
Public Function WB_Path() As String
Dim Path As String
Path = ThisWorkbook.Path
If Path <> "" Then
If Right$(Path, 1) <> "\" Then
Path = Path & "\"
WB_Path = Path
Burn the land and boil the sea
You can't take the sky from me
Last edited by Gruff; 07-01-2012 at 08:22 AM.