Get path with cell value excel vba
Solved
atoch
Posted messages
3
Status
Member
-
atoch Posted messages 3 Status Member -
atoch Posted messages 3 Status Member -
Hello everyone,
I have a path problem in my Excel 2013 file.
I have a model_folder in Windows with an Excel file in a subfolder.
I copy a model_folder from my Excel sheet, with cell values.
To stay within my company structure, I need to add a comma and a dash in the folder name, which gives for example: "D:\" & Range("D3") & "," & " " & Range("P3") & " " & Range("F4") & "-" & Range("U4"). It should be noted that the cell values are variable depending on each folder.
Example result: city, site 112636-GC.
Up to this point, no problem.
Then I want to search for the Windows folder that has a similar name, for example: "D:\" & Range("D3") & "," & " " & Range("P3"), which contains files like jpg, excel, mail, etc.
I want to copy these files into my subfolder "sales" of the created folder.
With a msgbox to ask: "do you want to copy the files?" yes or no.
Thank you in advance for your help.
Best regards, atoch.
I have a path problem in my Excel 2013 file.
I have a model_folder in Windows with an Excel file in a subfolder.
I copy a model_folder from my Excel sheet, with cell values.
To stay within my company structure, I need to add a comma and a dash in the folder name, which gives for example: "D:\" & Range("D3") & "," & " " & Range("P3") & " " & Range("F4") & "-" & Range("U4"). It should be noted that the cell values are variable depending on each folder.
Example result: city, site 112636-GC.
Up to this point, no problem.
Then I want to search for the Windows folder that has a similar name, for example: "D:\" & Range("D3") & "," & " " & Range("P3"), which contains files like jpg, excel, mail, etc.
I want to copy these files into my subfolder "sales" of the created folder.
With a msgbox to ask: "do you want to copy the files?" yes or no.
Thank you in advance for your help.
Best regards, atoch.
3 answers
Hello,
see this to browse a directory:
https://excel.developpez.com/faq/?page=FichiersDir#BoucleFichiers
and this to copy files:
https://excel-malin.com/tutoriels/vba-tutoriels/manipulation-basique-des-fichiers-en-vba/
and the choice MsgBoxes:
https://www.excel-pratique.com/fr/vba/boites_de_dialogue.php
see this to browse a directory:
https://excel.developpez.com/faq/?page=FichiersDir#BoucleFichiers
and this to copy files:
https://excel-malin.com/tutoriels/vba-tutoriels/manipulation-basique-des-fichiers-en-vba/
and the choice MsgBoxes:
https://www.excel-pratique.com/fr/vba/boites_de_dialogue.php
Hello,
thank you for the information and the link.
my issue is the folder path:
source folder path =("D:\" & Range("D3") & "," & " " & Range("P3"))
or
destination folder path:
("D:\" & Range("D3") & "," & " " & Range("P3") & " " & Range("F4") & "-" & Range("U4") & " \ Vente")
these 2 paths do not point to their respective folders.
there is an error somewhere, but I don't know where.
if you have any idea...
best regards
thank you for the information and the link.
my issue is the folder path:
source folder path =("D:\" & Range("D3") & "," & " " & Range("P3"))
or
destination folder path:
("D:\" & Range("D3") & "," & " " & Range("P3") & " " & Range("F4") & "-" & Range("U4") & " \ Vente")
these 2 paths do not point to their respective folders.
there is an error somewhere, but I don't know where.
if you have any idea...
best regards
In doing this, you will see where the error is, you will be able to correct it:
already this:
is written like this:
@+ The Woodpecker
MsgBox "D:\" & Range("D3") & "," & " " & Range("P3") MsgBox "D:\" & Range("D3") & "," & " " & Range("P3") & " " & Range("F4") & "-" & Range("U4") & " \ Vente" already this:
"," & " "
is written like this:
", "
@+ The Woodpecker