jsabo
10-04-2016, 11:13 AM
I am trying to just test out making a directory if one does not exist. Here is a test code I am running:
Sub mk_dir_basic()
'
' mk_dir_basic Macro
'
'
If Len(Dir("c:\TOTN\Excel\Examples", vbDirectory)) = 0 Then
mkdir ("c:\TOTN\Excel\Examples")
End If
End Sub
I get an error: "Compile Error: Wrong number of arguments or invalid property assignment". I have tried it with and without the parenthesis next to mkdir.
What seems odd is that Visual Basic is not capitalizing mkdir to MkDir, as if it does not recognize it as a function? Is there a VBA reference I have to activate? Thanks.
Sub mk_dir_basic()
'
' mk_dir_basic Macro
'
'
If Len(Dir("c:\TOTN\Excel\Examples", vbDirectory)) = 0 Then
mkdir ("c:\TOTN\Excel\Examples")
End If
End Sub
I get an error: "Compile Error: Wrong number of arguments or invalid property assignment". I have tried it with and without the parenthesis next to mkdir.
What seems odd is that Visual Basic is not capitalizing mkdir to MkDir, as if it does not recognize it as a function? Is there a VBA reference I have to activate? Thanks.