Rayne
asked on
Dot in Folder Name
Hello All,
I want to know if this is possible - if a folder has dot (.) in its name - it is possible to be referenced all right in a VBA code for copying file to that folder?
since there is always a problem as the code might think that the (.) means its a extension type and not a part of the folder name...like
folder name - C:\DR\RRTTYU 2013.09.09
thank you
Respect,
Rayne
I want to know if this is possible - if a folder has dot (.) in its name - it is possible to be referenced all right in a VBA code for copying file to that folder?
since there is always a problem as the code might think that the (.) means its a extension type and not a part of the folder name...like
folder name - C:\DR\RRTTYU 2013.09.09
thank you
Respect,
Rayne
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hello,
the code does not "think" about characters in the folder name at all. If the operating system accepts dots in folder names, so will VBA. You can easily declare string variables, assign value to these variables and then use the in operations with files. For example:
You don't have to use variables. You can use the folder name as direct reference if you prefer.
cheers, teylyn
the code does not "think" about characters in the folder name at all. If the operating system accepts dots in folder names, so will VBA. You can easily declare string variables, assign value to these variables and then use the in operations with files. For example:
Dim folder As String
Dim fileName As String
folder = "C:\testing\a folder with.a dot"
fileName = "MyWorkbook.xlsx"
Workbooks.Open fileName:=folder & "\" & fileName
You don't have to use variables. You can use the folder name as direct reference if you prefer.
Workbooks.Open fileName:="C:\testing\a folder with.a dot\MyWorkbook.xlsx"
cheers, teylyn
ASKER
Thank you Teylyn
ASKER
Hello All,
My next question is - is it possible to create a folder in VBA with (.) in the name?
Thank you
My next question is - is it possible to create a folder in VBA with (.) in the name?
Thank you
MkDir "C:\MyFolder\MySub.Folder"
ASKER
Awesome Graham :)
ASKER
Thank you a million GrahamSkan
Respect