Question: I've got a code in a dropdown box on my userform. Every time the user moves away from the drop down box, the code checks whether the value put by the user is correct (i.e. matches a list). If it doesn't, it triggers a message box. Here is my code:

```
Private Sub CmboxModifyRoute_Exit(ByVal Cancel As MSForms.ReturnBoolean)

UserValue = CmboxModifyRoute.Value
counter = 0
Cell = Range("C15").Value

If UserValue = "" Then Exit Sub

Do While (counter < 35 And Cell <> UserValue) 'checking if UserValue is valid
    counter = counter + 1
    Cell = Range("C15").Offset(counter, 0).Value
Loop

If counter > 34 Then 'if invalid, then display message box
    MsgBox "Invalid", vbExclamation
End If

End Sub

```

The problem occurs when I quit the userform with the "X" button or "Cancel" button. If the UserValue is invalid, it still shows me the "Invalid" message box after I have already quit the userform. I don't want it, I just want the userform to unload. How can I deal with this? Many thanks!

Answer: 
I'm surprised nobody has suggested a heredoc yet.

```
sudo ssh "$1" <<'EOF'
SRV=`cat /etc/puppet/puppet.conf | grep -i srv_domain | awk '{print $3}'`
echo $SRV
echo "puppetMaster=`host -t srv _x-puppet._tcp.$SRV | head -1 | awk '{print $8}' | cut -f1 -d"."`"
echo $puppetMaster
EOF

```

This feeds everything from the `<<'EOF'` until the line starting with `EOF` into the stdin of `ssh`, to be received and run by the remote shell.
The commands following `ssh machine` in a script are not run on the machine. They will be run on the local machine once the `ssh` exits.

Either specify the commands to run as an argument of `ssh`, or alternatively, run ssh and make it read the commands from standard input, and send the commands to it.

```
ssh machine ls
# or
echo ls | ssh machine

```