Multiple requirements-creating strings and writing to txt file

excel_beg

New Member
Joined
Jan 27, 2006
Messages
27
There are multiple parts to my requirements, so I'll list all, but a solution to any part/s will be appreciated.

My spreadsheet looks something like this (somehow the spaces don't stay!):

A(Name) B C D
fam_write_pp fam WRITE Family1_description
fam_pic DELETE
fam_doc DELETE

fam_restrict_pp fam NONE Family2
fam_sht DELETE

From the above, I then need to create a script which uses this information, and would translate to something like this (part of it is same for all)

create,ob,pp
set,ob,l,name
fam_write_pp <-----this is value from A1
set,ob,l,owner
dbo
set,c,l,description
Family1 description <-----this is value from D1
set,c,l,pp_class
3
grant,pp,l,dm_owner,7,change_owner,change_location,execute_proc <-----this is standard, to be repeated for all
grant,pp,l,dm_world,0,execute_proc <-----this is standard, to be repeated for all
grant,pp,l,fam,6,change_owner,change_permit,change_state,change_location,execute_proc <-----the number of lines here correspond to the number of entries in column B for each Name
grant,pp,l,fam_pic,7,change_owner,change_location,execute_proc
grant,pp,l,fam_doc,7,change_owner,change_location,execute_proc
save,pp,l

create,ob,pp
set,ob,l,name
fam_restrict_pp <-----this is value from A2
set,ob,l,owner
dbo
set,c,l,description
Family2 <-----this is value from D2
set,c,l,pp_class
3
grant,pp,l,dm_owner,7,change_owner,change_location,execute_proc <-----this is standard, to be repeated for all
grant,pp,l,dm_world,0,execute_proc <-----this is standard, to be repeated for all
grant,pp,l,fam,0,execute_proc the number of lines here correspond to the number of entries in column B for each Name. In this case 2
grant,pp,l,fam_sht,7,change_owner,change_location,execute_proc
save,pp,l

Hope the pattern is apparent.
The thing to note is that based on the values in column C, the numbers associated changes and so does the rest of the line.

So for example DELETE corresponds to a number 7 and the rest of the line would be "change_owner,change_location,execute_proc "
So there is a pattern to produce the grant bits.

For each value in column A there needs to be a corresponding script as in above example and ideally i'd like this to be written to a text file.
There needs to be a single blank line between each script for value in Name (column A)

Also, the number of entries in B can vary.

Hope this makes sense!
Even if I get a solution just so I can populate the 'grant' commands, that would help.

Many Many thanks...and I hope it makes sense!
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,223,247
Messages
6,171,007
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top