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

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
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,216,590
Messages
6,131,614
Members
449,658
Latest member
JasonEncon

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