ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   creating folders on hard drive from name field (https://www.excelbanter.com/excel-programming/330052-creating-folders-hard-drive-name-field.html)

Italian Pete

creating folders on hard drive from name field
 
Hi,
I have an excel spreadsheet containing information about people. The
first two columns are name and surname. In addition, for each person, there
is a separate photo (not attached to the spreadsheet). I need to create a
folder for each of the people on the spreadsheet such that I can put their
photo into it. I would like each of the folders to be named name.surname
taken from the spreadsheet. I'm a bit of a newbee to VBA in Excel. How would
I go about doing this?

many thanks,

Pete

Bob Phillips[_7_]

creating folders on hard drive from name field
 
Something like

Const kBaseFolder As String = ":C:\Staff\Photos\"

For i = 1 To cells(Rows.Count,"A").End(xlUp).Row
makdir kBaseFolder & Cells(i,"B").Value & "-" & Cells(i,"A").Value
Next i

I have added the forename as well, just in case there are tow with the same
surname.

--
HTH

Bob Phillips

"Italian Pete" wrote in message
...
Hi,
I have an excel spreadsheet containing information about people. The
first two columns are name and surname. In addition, for each person,

there
is a separate photo (not attached to the spreadsheet). I need to create a
folder for each of the people on the spreadsheet such that I can put their
photo into it. I would like each of the folders to be named name.surname
taken from the spreadsheet. I'm a bit of a newbee to VBA in Excel. How

would
I go about doing this?

many thanks,

Pete




Italian Pete

creating folders on hard drive from name field
 

Thanks Bob. Worked a treat.
"Bob Phillips" wrote:

Something like

Const kBaseFolder As String = ":C:\Staff\Photos\"

For i = 1 To cells(Rows.Count,"A").End(xlUp).Row
makdir kBaseFolder & Cells(i,"B").Value & "-" & Cells(i,"A").Value
Next i

I have added the forename as well, just in case there are tow with the same
surname.

--
HTH

Bob Phillips

"Italian Pete" wrote in message
...
Hi,
I have an excel spreadsheet containing information about people. The
first two columns are name and surname. In addition, for each person,

there
is a separate photo (not attached to the spreadsheet). I need to create a
folder for each of the people on the spreadsheet such that I can put their
photo into it. I would like each of the folders to be named name.surname
taken from the spreadsheet. I'm a bit of a newbee to VBA in Excel. How

would
I go about doing this?

many thanks,

Pete






All times are GMT +1. The time now is 03:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com