Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 208
Default Line Continuation issue

What am I doing wrong? Here is the line of code:

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet. Have you
completed "" ""PFs?", vbYesNo, "Completed PFs")

But I want to use ' _' to continue the phrase on the next line but when I do
this:

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet. _
Have you completed "" ""PFs?", vbYesNo, "Completed PFs")

I keep getting "Expected: list separator or )"
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Line Continuation issue

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet." & _
"Have you completed "" ""PFs?", vbYesNo, "Completed PFs")
--
If this post helps click Yes
---------------
Jacob Skaria


"Bishop" wrote:

What am I doing wrong? Here is the line of code:

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet. Have you
completed "" ""PFs?", vbYesNo, "Completed PFs")

But I want to use ' _' to continue the phrase on the next line but when I do
this:

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet. _
Have you completed "" ""PFs?", vbYesNo, "Completed PFs")

I keep getting "Expected: list separator or )"

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 896
Default Line Continuation issue

use

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet." &
vbNewLine & "Have you completed "" ""PFs?", vbYesNo, "Completed PFs")

On 21 Maj, 14:37, Bishop wrote:
What am I doing wrong? *Here is the line of code:

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet. Have you
completed "" ""PFs?", vbYesNo, "Completed PFs")

But I want to use ' _' to continue the phrase on the next line but when I do
this:

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet. *_
Have you completed "" ""PFs?", vbYesNo, "Completed PFs")

I keep getting "Expected: list separator or )"


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default Line Continuation issue

prompt Required. String expression displayed as the message in the
dialog box. The maximum length of prompt is approximately 1024 characters,
depending on the width of the characters used. If prompt consists of more
than one line, you can separate the lines using a carriage return character
(Chr(13)), a linefeed character (Chr(10)), or carriage return €“ linefeed
character combination (Chr(13) & Chr(10)) between each line.

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet." _
& Chr(10) & _
"Have you completed "" ""PFs?", vbYesNo, "Completed PFs")
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Jacob Skaria" wrote in message
...
Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet." & _
"Have you completed "" ""PFs?", vbYesNo, "Completed PFs")
--
If this post helps click Yes
---------------
Jacob Skaria


"Bishop" wrote:

What am I doing wrong? Here is the line of code:

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet. Have you
completed "" ""PFs?", vbYesNo, "Completed PFs")

But I want to use ' _' to continue the phrase on the next line but when I
do
this:

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet. _
Have you completed "" ""PFs?", vbYesNo, "Completed PFs")

I keep getting "Expected: list separator or )"


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Line Continuation issue

Oops..Use Vbcr Or VbLF for carriage return

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet." & vbCrLf & _
"Have you completed "" ""PFs?", vbYesNo, "Completed PFs")

If this post helps click Yes
---------------
Jacob Skaria


"Bishop" wrote:

What am I doing wrong? Here is the line of code:

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet. Have you
completed "" ""PFs?", vbYesNo, "Completed PFs")

But I want to use ' _' to continue the phrase on the next line but when I do
this:

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet. _
Have you completed "" ""PFs?", vbYesNo, "Completed PFs")

I keep getting "Expected: list separator or )"



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Line Continuation issue

Dear Bishop

A small suggestion. When you have bigger text to be displayed use a variable
to build the message before display..something like..the below

Dim intCount As Integer
Dim strMsg As String

strMsg = "You have " & intCount & " PFs loaded in the Tally Sheet."
strMsg = strMsg & vbCrLf & vbCrLf & " Have you completed " & intCount & "
PFs?"

If MsgBox(strMsg, vbYesNo + vbDefaultButton2, " Completed PFs") < vbYes _
Then Exit Sub


If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

Oops..Use Vbcr Or VbLF for carriage return

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet." & vbCrLf & _
"Have you completed "" ""PFs?", vbYesNo, "Completed PFs")

If this post helps click Yes
---------------
Jacob Skaria


"Bishop" wrote:

What am I doing wrong? Here is the line of code:

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet. Have you
completed "" ""PFs?", vbYesNo, "Completed PFs")

But I want to use ' _' to continue the phrase on the next line but when I do
this:

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet. _
Have you completed "" ""PFs?", vbYesNo, "Completed PFs")

I keep getting "Expected: list separator or )"

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,934
Default Line Continuation issue

Text strings constants (which are defined by a starting and ending quote
mark) must all appear on the same line. When you put your line continuation
character in, you left the quote marks unbalanced on the original line (no
ending quote mark) and on the newly created line (no starting quote mark).
You *cannot* simply put them in like this though...

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet." _
"Have you completed "" ""PFs?", vbYesNo, "Completed PFs")

because VB will not know what to do with the two parts. It would be like if
you wrote this line of code...

StrVar = "First part of sentence" "Next part of sentence"

To handle both of these, you would need an ampersand between the two text
string constants in order to concatenate them together. So, your original
line line of code could have been written this way...

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet. " & _
"Have you completed "" ""PFs?", vbYesNo, "Completed PFs")

Doing it this way, however, will just link the two text string constants
together as if they had been written in a single line. You would do it this
way in order to "neaten" up your code on the screen in order that *you*
could more read it more easily (as opposed to having a long text string
possibly trail off the screen because it is too long to display within the
given the code window's width. To do what I think you asked... display the
two individual text string constants on two separate lines within the
MessageBox... you have to tell VB to put a line separating character between
them. The help files say that you can use a Line Feed character, a Carriage
Return or a combination of Line Feed and Carriage Return characters (in that
order). VB has predefined characters for these line separating characters
and they are, in the same order I listed them in, vbLf, vbCr and vbLfCr. VB
also has an alternative constant for that last one... vbNewLine. So, using
vbLf as the separator, your original code line would be...

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet." & vbLf & _
"Have you completed "" ""PFs?", vbYesNo, "Completed PFs")

Now, when VB creates the MessageBox message, it will display the two text
string constants on separate lines.

--
Rick (MVP - Excel)


"Bishop" wrote in message
...
What am I doing wrong? Here is the line of code:

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet. Have you
completed "" ""PFs?", vbYesNo, "Completed PFs")

But I want to use ' _' to continue the phrase on the next line but when I
do
this:

Msg = MsgBox("You have "" "" PFs loaded in the Tally Sheet. _
Have you completed "" ""PFs?", vbYesNo, "Completed PFs")

I keep getting "Expected: list separator or )"


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Continuation of Page number in footer Junaid Excel Worksheet Functions 2 January 25th 09 11:41 AM
Line Continuation in combination chart CB Charts and Charting in Excel 2 June 24th 08 07:34 PM
formula continuation with the paint too. Fay New Users to Excel 2 March 17th 08 10:56 PM
Access line chart issue SysTech Charts and Charting in Excel 2 November 12th 06 04:16 PM
continuation from yesterday Mindy Excel Discussion (Misc queries) 4 June 22nd 06 11:13 PM


All times are GMT +1. The time now is 01:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"