Problem in passingmultiple parameters in Excel Macro

ashutosh152

New Member
Joined
Jan 7, 2011
Messages
2
Problem in running dtexec command with multiple parameters in macro:-

------code in macro-----

Dim Rsvr As String
Dim Runm As String

Rsvr = Sheets("update_xml").Range("C6")
Runm = Sheets("update_xml").Range("C7")

' MsgBox Rsvr ----value= Hi
' MsgBox Runm ----value= Hello

Call Shell("DTEXEC /f C:\Macro\xml_Table_updated_xml.dtsx /set \package.variables[User::InputRsvr].Value;&Rsvr /set \package.variables[User::InputRunm].Value;&Runm", vbNormalFocus)

when i run this macro, &Rsvr and &Runm in dtexec command is not assigned the values, i wanted these variables to be replaced by the "Hi" and "Hello" respectively.
I cannot hard code the values of the variables as they dynamic.

Please guide me how can provide parameters in call shell.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Welcome to the forum.

Maybe ...
Code:
    Call Shell("DTEXEC /f C:\Macro\xml_Table_updated_xml.dtsx /set \package.variables[User::Input" & _
               Rsvr & "].Value;&" & _
               Rsvr & " /set \package.variables[User::Input" & _
               Runm & "].Value;&" & _
               Runm, _
               vbNormalFocus)
 
Upvote 0
In practice, I would assign the built-up shell string to a string variable and then look at it. Then you can just shell the string variable.

Lots easier to debug.
 
Upvote 0
Thanks shg4421 for quick response.

I rather used the following code and it solved my purpose:-

Call Shell("DTEXEC /f C:\Macro\xml_Table_updated_xml.dtsx /set \package.variables[User::InputRsvr].Value;" & Rsvr & " /set \package.variables[User::InputRunm].Value;" & Runm, vbNormalFocus)

Anyways thanks for replying.
 
Upvote 0

Forum statistics

Threads
1,215,949
Messages
6,127,888
Members
449,411
Latest member
AppellatePerson

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