Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Complex Text Strings|Variables

Hello

I have a VBA program which creates scripts. Large portions of the script
are "static" so I do not want to clutter the code for writing the "variable"
part of the script with the static content (200 lines).

I thought a solution would be to have a string variable which is equal to
the static portion of the script then append it to the variable portion once
it has been created, then save out the final appended file to disk.

The static portion is 200 lines of text, however. How can I create a text
variable in VBA to "equal" the static 200 lines of text?

Many thanks in advance

W


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Complex Text Strings|Variables

Not sure what you mean.
Are you meaning self-modifying code? In which case you'll need to do a
search for VBE in help
There are some examples on my website.
Chip Pearson has some good information too:
http://www.cpearson.com/excel/vbe.htm


If you're meaning some very long string:

str = "this is line 1" & vbNewLine & _
"this is line 2" & vbNewLine
str = str & _
"this is line 3" & vbNewLine & _
"this is line 4" & vbNewLine


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"cogent" wrote in message
...
Hello

I have a VBA program which creates scripts. Large portions of the script
are "static" so I do not want to clutter the code for writing the

"variable"
part of the script with the static content (200 lines).

I thought a solution would be to have a string variable which is equal to
the static portion of the script then append it to the variable portion

once
it has been created, then save out the final appended file to disk.

The static portion is 200 lines of text, however. How can I create a text
variable in VBA to "equal" the static 200 lines of text?

Many thanks in advance

W




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Complex Text Strings|Variables

Store the static 200 lines in a text file and have your program read
the file contents into a variable.
Or paste the 200lines into a cell and read it from there.


Tim.


"cogent" wrote in message
...
Hello

I have a VBA program which creates scripts. Large portions of the

script
are "static" so I do not want to clutter the code for writing the

"variable"
part of the script with the static content (200 lines).

I thought a solution would be to have a string variable which is

equal to
the static portion of the script then append it to the variable

portion once
it has been created, then save out the final appended file to disk.

The static portion is 200 lines of text, however. How can I create

a text
variable in VBA to "equal" the static 200 lines of text?

Many thanks in advance

W




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Complex Text Strings|Variables

On a side note - does anyone know the max length of a single string
variable? I thought I'd read somewhere that it's 65536 chars, but that
might've been for an earlier version of vba or for vb6.



On or about 06/04/2004 15:13, Tim Williams was seen in the vicinity and
allegedly stated:


Store the static 200 lines in a text file and have your program read
the file contents into a variable.
Or paste the 200lines into a cell and read it from there.


Tim.


"cogent" wrote in message
...

Hello

I have a VBA program which creates scripts. Large portions of the


script

are "static" so I do not want to clutter the code for writing the


"variable"

part of the script with the static content (200 lines).

I thought a solution would be to have a string variable which is


equal to

the static portion of the script then append it to the variable


portion once

it has been created, then save out the final appended file to disk.

The static portion is 200 lines of text, however. How can I create


a text

variable in VBA to "equal" the static 200 lines of text?

Many thanks in advance

W






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Complex Text Strings|Variables

String limits:
Fixed length 2^16 (~ 65000)
Variable Length 2^31 (~ 2 billion)

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Graeme Whelan" wrote in message
...
On a side note - does anyone know the max length of a single string
variable? I thought I'd read somewhere that it's 65536 chars, but that
might've been for an earlier version of vba or for vb6.



On or about 06/04/2004 15:13, Tim Williams was seen in the vicinity and
allegedly stated:


Store the static 200 lines in a text file and have your program read
the file contents into a variable.
Or paste the 200lines into a cell and read it from there.


Tim.


"cogent" wrote in message
...

Hello

I have a VBA program which creates scripts. Large portions of the


script

are "static" so I do not want to clutter the code for writing the


"variable"

part of the script with the static content (200 lines).

I thought a solution would be to have a string variable which is


equal to

the static portion of the script then append it to the variable


portion once

it has been created, then save out the final appended file to disk.

The static portion is 200 lines of text, however. How can I create


a text

variable in VBA to "equal" the static 200 lines of text?

Many thanks in advance

W








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
find and replace numeric strings in larger text strings Mr Molio Excel Worksheet Functions 8 November 9th 11 05:17 PM
Complex lookup array with 4 variables Ronan Excel Worksheet Functions 4 November 28th 08 01:02 AM
Finding text strings in complex situations Hardel Excel Discussion (Misc queries) 6 July 25th 06 01:55 PM
Combining Text Strings - Complex ksawyers Excel Worksheet Functions 1 August 9th 05 08:11 PM
Converting strings to Sum worksheet function and control variables Spammastergrand Excel Programming 5 February 21st 04 05:12 PM


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