Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default 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
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
Double Quotes [email protected] New Users to Excel 2 July 20th 08 12:43 PM
Double Quotes PeterM Excel Discussion (Misc queries) 5 June 17th 08 05:12 PM
Quotes around text in Msgbox davegb[_2_] Excel Programming 6 March 3rd 08 05:56 PM
Double Quotes Ed Excel Programming 1 January 13th 04 01:13 AM
Double Quotes Ed Excel Programming 1 January 12th 04 09:18 PM


All times are GMT +1. The time now is 08:25 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"