#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default help

I'm trying to create a macro to automatic a tedious task. I need help
with a macro to concentatenate a string.

For example, I have a list of usercodes:

Column
A

nx109
px205
px206
qx123

I want to add the usercodes to a string that reads like this.

sp_addexternlogin SQL_PROD, wr_",nx109,", trust_user , trustuser"
go
sp_addexternlogin SQL_PROD, wr_",px205,", trust_user , trustuser"
go
sp_addexternlogin SQL_PROD, wr_",px206,", trust_user , trustuser"
go
sp_addexternlogin SQL_PROD, wr_",qx123,", trust_user , trustuser"
go

Please Help





*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default help

Hi,
Try this:

Function AddParm(vstr)
AddParm = "sp_addexternlogin SQL_PROD, wr_""," & vstr & ","", trust_user ,
trustuser"" go"
End Function

Sub test()
Debug.Print AddParm("nx109")
End Sub

HTH

"Ken Barrett" wrote:

I'm trying to create a macro to automatic a tedious task. I need help
with a macro to concentatenate a string.

For example, I have a list of usercodes:

Column
A

nx109
px205
px206
qx123

I want to add the usercodes to a string that reads like this.

sp_addexternlogin SQL_PROD, wr_",nx109,", trust_user , trustuser"
go
sp_addexternlogin SQL_PROD, wr_",px205,", trust_user , trustuser"
go
sp_addexternlogin SQL_PROD, wr_",px206,", trust_user , trustuser"
go
sp_addexternlogin SQL_PROD, wr_",qx123,", trust_user , trustuser"
go

Please Help





*** Sent via Developersdex http://www.developersdex.com ***

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"