Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default InsertLines Syntax

I want to add a variable to an inserted line, but I can't seem to get
the syntax right.

I have for instance:

With TempForm.CodeModule
X = .CountOfLines
Dim y

for y = 1 to 10
.InsertLines X + y, "MsgBox ""This is message "" & y"
next y

End With

The code is inserted into the module, but this is the result for each
MsgBox:

MsgBox "This is message " & y


I just can't seem to get the variable to be part of the code.

Any help will be appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default InsertLines Syntax

..InsertLines x + y, "MsgBox ""This is message "" & " & y

--
Tim Zych
www.higherdata.com
Compare data in Excel and find differences with Workbook Compare
A free, powerful, flexible Excel utility


"Stephen Newman" wrote in message
...
I want to add a variable to an inserted line, but I can't seem to get
the syntax right.

I have for instance:

With TempForm.CodeModule
X = .CountOfLines
Dim y

for y = 1 to 10
.InsertLines X + y, "MsgBox ""This is message "" & y"
next y

End With

The code is inserted into the module, but this is the result for each
MsgBox:

MsgBox "This is message " & y


I just can't seem to get the variable to be part of the code.

Any help will be appreciated.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default InsertLines Syntax

On Mon, 7 Jul 2008 20:34:24 -0700, "Tim Zych"
<tzych@NOSp@mE@RTHLINKDOTNET wrote:

It never occurred to me that everything on the line beyond the comma
would be inserted. I threw a lot of "Expected End Of Statement" errors
trying to keep everything within the quotes. Thank you.

.InsertLines x + y, "MsgBox ""This is message "" & " & y

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
Problem in InsertLines and CreateEventProc [email protected] Excel Programming 1 November 18th 05 12:06 PM
VBA syntax marcmc Excel Programming 2 November 2nd 05 03:54 PM
InsertLines crashes Excel asleeper Excel Programming 5 October 14th 05 05:13 AM
InsertLines crashes Excel Andy Sleeper Excel Programming 3 August 29th 05 05:57 AM
InsertLines and AddFromString crash excel Chip R. Excel Programming 1 August 13th 04 03:28 PM


All times are GMT +1. The time now is 06:09 PM.

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"