Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Double Quotes in MsgBox!
Hi,
I'm trying to copy code from personal.xls to the active workbook. Here is part of the code: I have noted where my problem line is. I know I'm not using the & DQUOTE properly, but can't figure it out. I have line breaks to make the dialog box more readable, BTW... Sub Test() Dim VBProj As VBIDE.VBProject Dim VBComp As VBIDE.VBComponent Dim CodeMod As VBIDE.CodeModule Dim LineNum As Long Const DQUOTE = """" ' one " character Set VBProj = ActiveWorkbook.VBProject Set VBComp = VBProj.VBComponents("ThisWorkbook") Set CodeMod = VBComp.CodeModule With CodeMod LineNum = .CountOfLines + 1 .InsertLines LineNum, "Private Sub Workbook_Open()" LineNum = LineNum + 1 .InsertLines LineNum, "Application.DisplayAlerts = False" LineNum = LineNum + 1 .InsertLines LineNum, "Dim oAction As Integer" LineNum = LineNum + 1 ***This is the line I'm having problems with** .InsertLines LineNum, " oAction = MsgBox(Prompt:=" & DQUOTE & "WILL YOU EDIT THE FILE?" & vbNewLine & vbNewLine & "Click 'YES' if opening to EDIT" & vbNewLine & vbNewLine & "Click 'NO' if opening to VIEW or PRINT & dquote & ", Buttons:=vbYesNo, Title:=" & dquote FILE OPEN:" & DQUOTE & ")" LineNum = LineNum + 1 Thanks very much. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Double Quotes in MsgBox!
"Joyce" wrote:
[...] "Click 'NO' if opening to VIEW or PRINT & dquote & ", Buttons:=vbYesNo, [...] You seem to have missed a double-quote mark after "PRINT", in order to close the literal text and switch back to the use of the & concatenation operator. Eq. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Double Quotes in MsgBox!
Dim S as Long
S = MsgBox(prompt:="WILL YOU EDIT THE FILE?" & vbNewLine & vbNewLine & _ "Click 'YES' if opening to EDIT" & vbNewLine & vbNewLine & _ "Click 'NO' if opening to VIEW or PRINT", Buttons:=vbYesNo, Title:=" FILE OPEN:") -- Jim Cone Portland, Oregon USA "Joyce" wrote in message Hi, I'm trying to copy code from personal.xls to the active workbook. Here is part of the code: I have noted where my problem line is. I know I'm not using the & DQUOTE properly, but can't figure it out. I have line breaks to make the dialog box more readable, BTW... -snip ***This is the line I'm having problems with** .InsertLines LineNum, " oAction = MsgBox(Prompt:=" & DQUOTE & "WILL YOU EDIT THE FILE?" & vbNewLine & vbNewLine & "Click 'YES' if opening to EDIT" & vbNewLine & vbNewLine & "Click 'NO' if opening to VIEW or PRINT & dquote & ", Buttons:=vbYesNo, Title:=" & dquote FILE OPEN:" & DQUOTE & ")" LineNum = LineNum + 1 Thanks very much. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Double Quotes in MsgBox!
Thanks for your help. I noticed another one I had forgotten, but was
reassured to know I was on the write path! "Paul E Collins" wrote: "Joyce" wrote: [...] "Click 'NO' if opening to VIEW or PRINT & dquote & ", Buttons:=vbYesNo, [...] You seem to have missed a double-quote mark after "PRINT", in order to close the literal text and switch back to the use of the & concatenation operator. Eq. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Double Quotes in MsgBox!
I spoke too soon... Here is the updated code. It results in the first line
being copied into the active workbook -it ignores the rest, so I must again be doing something wrong. oAction = MsgBox(Prompt:="WILL YOU EDIT THE FILE?" ..InsertLines LineNum, " oAction = MsgBox(Prompt:=" & DQUOTE & "WILL YOU EDIT THE FILE?" & DQUOTE & vbNewLine & vbNewLine & DQUOTE & "Click 'YES' if opening to EDIT" & DQUOTE & vbNewLine & vbNewLine & DQUOTE & "Click 'NO' if opening to VIEW or PRINT" & DQUOTE & ", Buttons:=vbYesNo, Title:=" & DQUOTE & "FILE OPEN:" & DQUOTE & ")" Thanks very much. "Paul E Collins" wrote: "Joyce" wrote: [...] "Click 'NO' if opening to VIEW or PRINT & dquote & ", Buttons:=vbYesNo, [...] You seem to have missed a double-quote mark after "PRINT", in order to close the literal text and switch back to the use of the & concatenation operator. Eq. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Double Quotes in MsgBox!
And if you actually want to put all the text inside quote marks then...
Dim oAction Dim DQUOTE As String DQUOTE = Chr$(34) oAction = MsgBox(Prompt:=DQUOTE & "WILL YOU EDIT THE FILE?" & _ DQUOTE & vbNewLine & vbNewLine & DQUOTE & _ "Click 'YES' if opening to EDIT" & DQUOTE & vbNewLine & _ vbNewLine & DQUOTE & "Click 'NO' if opening to VIEW or PRINT" & _ DQUOTE, Buttons:=vbYesNo, Title:=DQUOTE & "FILE OPEN:" & DQUOTE) -- Jim Cone Portland, Oregon USA |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Double Quotes | New Users to Excel | |||
Double Quotes | Excel Discussion (Misc queries) | |||
Quotes around text in Msgbox | Excel Programming | |||
Double Quotes | Excel Programming | |||
Double Quotes | Excel Programming |