View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Joyce Joyce is offline
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.