Hi all, after much lurking I'm here with a real question.
I'm trying to use VBA to create a new folder named after the client, then save an excel file in that new folder.
I'm able to create the folder, but my folder name output is not what I was expecting (it's coming out as a 10 digit number rather than a name). Here's a sample of the important stuff in vba:
When I run this, the program completes. But when I look at the output for the folder it is a ten digit number. I know I could just Dim the custname As String and it would work, but I really want to remove the comma and just have the last name and first letter of the first name as the folder's name. Obviously I'm self taught in vba and have huge holes in my skills.
Any ideas would be appreciated!
I'm trying to use VBA to create a new folder named after the client, then save an excel file in that new folder.
I'm able to create the folder, but my folder name output is not what I was expecting (it's coming out as a 10 digit number rather than a name). Here's a sample of the important stuff in vba:
Code:
Sub cust_install_()
Dim copier As Workbook
Dim paster As Workbook
Dim custname As Variant 'this is a customer's last and first name separated by a comma
ReDim custname(0 To 1)
Dim flnm As String
'Dim flnm2 As String
''''' code, mostly copy and pasting
Set custname = Split(ActiveCell, ", ")
flnm = custname(0)
'flnm2 = custname(1, 1) --- removed this because I kept getting a Error 9: sub script out of range
MkDir "U:\Common\" & flnm ' to name the directory after the last name of the customer
paster.SaveAs Filename:="U:\Common\" & flnm & "\" & Range("A13") & " install form"
When I run this, the program completes. But when I look at the output for the folder it is a ten digit number. I know I could just Dim the custname As String and it would work, but I really want to remove the comma and just have the last name and first letter of the first name as the folder's name. Obviously I'm self taught in vba and have huge holes in my skills.
Any ideas would be appreciated!