You can concatenate the value into the string.
' I use a string variable but it's not necessary.
Dim strMessage As String
' Here I use varRangeValue as a place holder for what ever value you want to
' concatenate into the string.
strMessage = "Would you like to Print Preview this " & varRangeValue & " Range?"
' Also note that I use a bitwise OR operation to combine the enumerator values for the
' Buttons argument of the MsgBox function.
Answer = MsgBox(strMessage, vbQuestion Or vbYesNo, "Confirm Preview")
Maybe I should clarify the note about the bitwise OR operation.
Let's say for argument sake that you made a boo-boo and entered in the values for the Buttons argument as:
vbQuestion + vbYesNo + vbYesNo
This would infact assign a value of 40 to the Buttons argument.
Whereas, if you use the bitwise OR operation and made the same boo-boo:
vbQuestion Or vbYesNo Or vbYesNo
This would assign the correct value of 36 to the Buttons argument.
This is because the Or statement used here is actually setting the bits that will make up the value passed and not adding all of the numbers together and then passing the resulting value.
The only stupid question is the one that goes un-asked.
Last edited by 00100b; 10-08-2004 at 02:29 PM.