ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Combined text and variable in a message box (https://www.excelbanter.com/excel-programming/398244-combined-text-variable-message-box.html)

[email protected]

Combined text and variable in a message box
 
I'm trying to display message box that combines text along with a
variable that was previously defined. The following code only
displays the date that's contained in the variable Dt, but it doesn't
display the text. How can this be done?


Dt = "Records prior to " & Dt & " have been removed"
MsgBox Dt

Thanks.


JW[_2_]

Combined text and variable in a message box
 
This works just fine for me.
Dt = 5
Dt = "Records prior to " & Dt & " have been removed"
MsgBox Dt

Not sure why it's not working for you. You could always use something
like:
Dt = 5
MsgBox "Records prior to " & Dt & " have been removed"
or
Dt = 5
msgString = "Records prior to " & Dt & " have been removed"
MsgBox msgString

wrote:
I'm trying to display message box that combines text along with a
variable that was previously defined. The following code only
displays the date that's contained in the variable Dt, but it doesn't
display the text. How can this be done?


Dt = "Records prior to " & Dt & " have been removed"
MsgBox Dt

Thanks.



Incidental

Combined text and variable in a message box
 
Hi

your code seems ok though it looks like you are changing the data held
in Dt to the string of text rather than your date variable??

MsgBox "Records prior to " & Dt & " have been removed"

seems to work fine for me.

S



Tom Ogilvy

Combined text and variable in a message box
 

MsgBox "Records prior to " & Dt & " have been removed"

--
Regards,
Tom Ogilvy


" wrote:

I'm trying to display message box that combines text along with a
variable that was previously defined. The following code only
displays the date that's contained in the variable Dt, but it doesn't
display the text. How can this be done?


Dt = "Records prior to " & Dt & " have been removed"
MsgBox Dt

Thanks.




All times are GMT +1. The time now is 02:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com