+ Reply to Thread
Results 1 to 6 of 6

Problem with coding a msgbox

  1. #1
    Jacqui
    Guest

    Problem with coding a msgbox

    This should be simple but somehow I can't get this right. Can anyone help
    with the syntax below

    Msgbox("You have not supplied all the relevant information for this Segment
    type in Row " _ & myCell.Row & " on the Coding Details Sheet - PLEASE
    ENTER ALL DETAILS" _
    , 48, "Change Request Form Error Checks")

    I'd like a vbexclamation style msgbox hence code 48 as style with an OK only
    button and I'd also like to insert a title. I've coded similar to this
    before without using all the Dim statements as in the VB help but I can't get
    this to work without a Compile Error Expected: =. Also where could I insert
    the ((Chr 13) command to force a carraige return as my prompt message is
    quite lengthy. Can anyone kindly help please?

    Many thanks
    Jacqui

  2. #2
    Kleev
    Guest

    RE: Problem with coding a msgbox

    It expects you to assign it to something because it is in parenthesis.
    Either say something like var = msgbox("whatever") or msgbox "whatever"

    "Jacqui" wrote:

    > This should be simple but somehow I can't get this right. Can anyone help
    > with the syntax below
    >
    > Msgbox("You have not supplied all the relevant information for this Segment
    > type in Row " _ & myCell.Row & " on the Coding Details Sheet - PLEASE
    > ENTER ALL DETAILS" _
    > , 48, "Change Request Form Error Checks")
    >
    > I'd like a vbexclamation style msgbox hence code 48 as style with an OK only
    > button and I'd also like to insert a title. I've coded similar to this
    > before without using all the Dim statements as in the VB help but I can't get
    > this to work without a Compile Error Expected: =. Also where could I insert
    > the ((Chr 13) command to force a carraige return as my prompt message is
    > quite lengthy. Can anyone kindly help please?
    >
    > Many thanks
    > Jacqui


  3. #3
    Jacqui
    Guest

    RE: Problem with coding a msgbox

    Thanks Kleev. Can you demo in my code, I understand your reply but am not
    sure how to fix the VBA. Also any chance you could help insert the ((Chr 13)
    in the correct place.

    Thanks
    Jacqui

    "Kleev" wrote:

    > It expects you to assign it to something because it is in parenthesis.
    > Either say something like var = msgbox("whatever") or msgbox "whatever"
    >
    > "Jacqui" wrote:
    >
    > > This should be simple but somehow I can't get this right. Can anyone help
    > > with the syntax below
    > >
    > > Msgbox("You have not supplied all the relevant information for this Segment
    > > type in Row " _ & myCell.Row & " on the Coding Details Sheet - PLEASE
    > > ENTER ALL DETAILS" _
    > > , 48, "Change Request Form Error Checks")
    > >
    > > I'd like a vbexclamation style msgbox hence code 48 as style with an OK only
    > > button and I'd also like to insert a title. I've coded similar to this
    > > before without using all the Dim statements as in the VB help but I can't get
    > > this to work without a Compile Error Expected: =. Also where could I insert
    > > the ((Chr 13) command to force a carraige return as my prompt message is
    > > quite lengthy. Can anyone kindly help please?
    > >
    > > Many thanks
    > > Jacqui


  4. #4
    Gary Keramidas
    Guest

    Re: Problem with coding a msgbox

    try this, i just set mycell to a value so i could get it to work, all you
    need is the call msgbox line


    Dim mycell As Range
    Set mycell = Range("a1")
    Call MsgBox("You have not supplied all the relevant information for this
    Segment type in Row " _
    & mycell.Row & " on the Coding Details Sheet - PLEASE ENTER ALL DETAILS",
    vbExclamation, "Change Request Form Error Checks")

    --


    Gary


    "Jacqui" <Jacqui@discussions.microsoft.com> wrote in message
    news:8434B283-B13C-40AD-A530-CEB299FB3323@microsoft.com...
    > This should be simple but somehow I can't get this right. Can anyone help
    > with the syntax below
    >
    > Msgbox("You have not supplied all the relevant information for this
    > Segment
    > type in Row " _ & myCell.Row & " on the Coding Details Sheet - PLEASE
    > ENTER ALL DETAILS" _
    > , 48, "Change Request Form Error Checks")
    >
    > I'd like a vbexclamation style msgbox hence code 48 as style with an OK
    > only
    > button and I'd also like to insert a title. I've coded similar to this
    > before without using all the Dim statements as in the VB help but I can't
    > get
    > this to work without a Compile Error Expected: =. Also where could I
    > insert
    > the ((Chr 13) command to force a carraige return as my prompt message is
    > quite lengthy. Can anyone kindly help please?
    >
    > Many thanks
    > Jacqui




  5. #5
    Carlos
    Guest

    Re: Problem with coding a msgbox

    Hi Jacqui
    try
    dim your_msg as string

    your_msg = "words"
    MsgBox your_msg, vbInformation + vbOKOnly, "Change Request Form Error
    Checks"

    Carlos


    "Jacqui" <Jacqui@discussions.microsoft.com> wrote in message
    news:8434B283-B13C-40AD-A530-CEB299FB3323@microsoft.com...
    > This should be simple but somehow I can't get this right. Can anyone help
    > with the syntax below
    >
    > Msgbox("You have not supplied all the relevant information for this
    > Segment
    > type in Row " _ & myCell.Row & " on the Coding Details Sheet - PLEASE
    > ENTER ALL DETAILS" _
    > , 48, "Change Request Form Error Checks")
    >
    > I'd like a vbexclamation style msgbox hence code 48 as style with an OK
    > only
    > button and I'd also like to insert a title. I've coded similar to this
    > before without using all the Dim statements as in the VB help but I can't
    > get
    > this to work without a Compile Error Expected: =. Also where could I
    > insert
    > the ((Chr 13) command to force a carraige return as my prompt message is
    > quite lengthy. Can anyone kindly help please?
    >
    > Many thanks
    > Jacqui




  6. #6
    Jake Marx
    Guest

    Re: Problem with coding a msgbox

    Hi Jacqui,

    First of all, get rid of the parenthesis, as you aren't retrieving the
    return value, so you don't need them. Second, I would suggest using the
    built-in MsgBox constants instead of 48, as it's more readable and easier to
    make changes to in the future.

    Here's a version that works for me:

    MsgBox "You have not supplied all the relevant information for " & _
    "this Segment type in Row " & myCell.Row & " on the Coding " & _
    "Details Sheet." & vbLf & "PLEASE ENTER ALL DETAILS", vbExclamation _
    Or vbOKOnly, "Change Request Form Error Checks"

    --
    Regards,

    Jake Marx
    www.longhead.com


    [please keep replies in the newsgroup - email address unmonitored]

    Jacqui wrote:
    > This should be simple but somehow I can't get this right. Can anyone
    > help with the syntax below
    >
    > Msgbox("You have not supplied all the relevant information for this
    > Segment type in Row " _ & myCell.Row & " on the Coding Details
    > Sheet - PLEASE ENTER ALL DETAILS" _
    > , 48, "Change Request Form Error Checks")
    >
    > I'd like a vbexclamation style msgbox hence code 48 as style with an
    > OK only button and I'd also like to insert a title. I've coded
    > similar to this before without using all the Dim statements as in the
    > VB help but I can't get this to work without a Compile Error
    > Expected: =. Also where could I insert the ((Chr 13) command to
    > force a carraige return as my prompt message is quite lengthy. Can
    > anyone kindly help please?
    >
    > Many thanks
    > Jacqui




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1