Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

How To Concatenate Rtf Documents

Hello fellow developers,

I am trying to concatenate a number of rtf documents into one singe MS Word document. Any recommendations on how to do that programmatically ?

Thanks in advance for your help !


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Concatenate Two Documents
I have a problem to concatenate two documents into one. Is there way to dothis in vbscript?

Concatenate Word Documents
Hi ,
How can I concatenate 2 or more word documents in a single one, but without using the copy-paste solution?

Concatenate This....
... I need something that looks like this:
1H04 is a variable taken from an access table, the idea is to set that variable as default value for a field in the form.
field.DefaultValue = variable
isnīt enough
any ideas???

Hello: Can someone tell me why the second part of this formula does not work? If I enter data in collumn "A" it works fine, but if I enter data in collumn "D" nothing happens. Thanks Dan

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 And Target.Count = 1 Then
Application.EnableEvents = False
Target.Offset(0, 5).Formula = "=IF(" & "A" & Target.Row & "=1,CONCATENATE($Y13,$Z13),0)"
Application.EnableEvents = True

If Target.Column = 4 And Target.Count = 1 Then
Application.EnableEvents = False
Target.Offset(0, 2).Formula = "=IF(" & "D" & Target.Row & "=1,CONCATENATE($Y13,$Z13,$U13),0)"
Application.EnableEvents = True
End If
End If
End Sub

I'm a new user to VB but I thought I'd bring up a few questions, the first about concatenating.

How do I get the first three letters of what a user has entered in a text box to appear as a new string?

i need to select some numbers out of a string, the string format is like this:

Alex Vo <#1>|Andy Woo <#5236>|Louis 2 <#258>

i just want to get the # and the number out. thanks for your help

Concatenate Files
heres my problem.

I am trying to join multiple files together. each file is approx 20mb in size and there could be upto 200 hundred of them.

I have been using the dos COPY B/ which works fine upto 99 files. Each file is numbered numerically ie 01,02,03 etc.

Above 99 files COPY /B will join like 01,02,03,04,05,06,07,08,09,100,101 etc.

Any way to avoid this. Because of the size I don't want to put into memory, and won't reading as binary, be a bit slow, with continual get and put statements.

help please

Concatenate A String
Hi there,

I'm trying to generate an email where values are passed from an excel spreadsheet. My code is working, but the values are not coming in from the sheet.

I think I'm not concatenating the string/output properly. Can someone advise what I'm doing wrong?

Sub copy_into()
Dim user As String
Dim date_received As String
Dim assigned_staff As String
Dim email As String
Dim sender As String
Dim mgr_email As String
Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(olMailItem)


user = Sheet1.Range("a3").Value
date_received = Sheet1.Range("b3").Value
assigned_staff = Sheet1.Range("d3").Value
email = ""
mgr_email = Sheet1.Range("f3").Value
sender = Sheet1.Range("e3").Value

With olMail
.To = email
.Subject = "Automated Response/Testing Excel Automated Email Response."
.Body = "FAO: " & Sheet1.Range("e3").Value & "This is an automated response to your query regarding" & _
Sheet1.Range("f3").Value & "This task has been assigned to: " & _
Sheet1.Range("d3").Value & "Your job number is: " & Sheet1.Range("a3").Value & _
"Please quote this reference number when making any further inquiries."

End With

MsgBox (" your Email was sent To this user: " & day_phone)

End Sub

I've tried the output section like this also:

With olMail
.To = email
.Subject = "Automated Response/Testing Excel Automated Email Response."
.Body = "FAO: " & sender & _
"This is an automated response to your query regarding" & _
mgr_email & "This task has been assigned to: " & assigned_staff & _
"Your job number is: " & user & _
"Please quote this reference number when making any further inquiries."

but that doesn't work either.

Any help would be greatly appreciated!



Concatenate Cells

I have a problem with concatenation. I would like to do the following:

Cells(i, 1) = cells(i, 2) + "//"

the problem is that in the second colum I have both plain numbers and numbers attached to characters:

If I do Cells(i, 1) = str(cells(i, 2)) + "//"

It works only for the numbers. How can I always read the cell as a string?


Concatenate With Semicolons
I need to take a excel file with variable amount of data. In that I mean that there will never be more then ten columns of data but the rows could go onto 200 would be the most I could see the data going to. What I need to do is to loop through each line, concatenating each row with semicolons between each column and outputting this newly concatented row with 10 columns to a text file and continue on this process until the excel file is finished. If anyone has any idea on how to do this I would appriciate. Thanks so much!!!


Excel File

c1: lastname
d1: gid
e1: company
f1: phone
g1: email
h1: usertype
j1: access group
k1: location

all the data in the rows below these heading has to be concatenated with semicolons and saved to a text file regardless if there is 1 row of user information or 200 rows of user information.


Concatenate Byte

i have the following declarations in my project.

dim s() as byte
dim s1() as byte

how can i concatenate the data in those 2 byte arrays to a single
array ?

plz help

Concatenate Variables
Hi. I'm trying to concatenate variables. Unfortunately, I just can't find way to convert string to variable.

In fact, I want to do a for loop that will give me the same number of variables that the number of loop:

for i=0 to 12
var & i = ...
next i

Is this possible in VB ???

Thanks a lot

Concatenate Question
Hello Everyone,

If I have the following data:

Column A

Column B
Fuel Pump
Fuel Injector
Air Cleaner
Driver Seat

How can I concatenate this into a string that reads:


(where spaces are treated as "%20" for a future web query that I'll be sending each concatenated string to.)

so that each vehicle model has a concatenated string for each vehicle component?

My individual formula(s) looks like the following:


and so on...

and I'm Finding/Replacing spaces with the "%20" beforehand. The entire file contains 77 vehicle models and approximately 44 vehicle component types, that periodically gets updated.

Forgive my ignorance (my brain cells received too much stimulation last evening), but how can I write this in VBA to read through all the data in Column A and assign each value in Column B in this form of string?

Thanks for your insight.


Concatenate RTB Boxes
hi, how i can concatenate RTB textboxes with formatted text??
i mean, with color and especials simbols

sorry, my english is not good but you can understand me isn't?

thanks for your help

Concatenate Recordset
Is this possible:

For z = 1 To UBound(vLineScore)
test = rs!ctlInn & z
test = vLineScore(z)

My problem is 'rs!ctlInn' could be anywhere from 10 to 18 columns. So I need to somehow exit out of the 'addnew' when it ends. So I tried to concatenate but that puts quotes in 'test'. Is there a way to concatenate the subscript 'z' with the recordset?

Concatenate SQL Ntext
Is there a way I can concatenate ntext variables in sql server?


Concatenate Arrays
is it possible to put arrays together into one big array?

Concatenate Two Fields Using ADO
Hiya all,

I'm sorta going nuts on this, been at it all night, trying to concatenate two fields using ADO and DB2.

Here's the code:

Criteria = "Select (LYR & PER) as TEST from GL"
generates error. Doesn't take the &.

I tried also:
Criteria = "Select (LYR + PER) as TEST from GL"
no luck. + not accpeted.

Tried & "&" & , + ' ' +...nothing works.

Any idea?

Concatenate Function
Hey guys,

I got a question about concatenate() function. I was working on a simple VB project where I would get information from a form and populate it into an Excel wooksheet. I found out that I have to import it to a table on access database and at the same time I have to combine two columns from spreadsheet when I import it into the database. For Example:

Column 1 Column 2
22 001
22 002
22 010
33 011
55 051
66 101
77 110
88 210

My question is what is the easiest and most efficient of concatenating it? Currently, I have the 2 columns as text so I can have the leading zeros if necessary.

The "&" symbol in Access truncates the leading zeros. So, I tried by sticking "0" in the middle, but access is dropping the trailing number in the ends.

I was looking at excel about Concatenate() function. I took the relevent columns and made a seperate sheet. The third column would have the concatenated field. I thought it was simple plugging in the cells that I wanted to concatenate. But it is only displaying the function(formula) and NOT the answer. Note: I have both columns as text to display the leading zeros.

Any Solutions?

Thanxs in advance ,


Concatenate Fields
I'm doing an address search from a database. The fields are stored like this StrAdd; Str; StrTyp; StrDir. When I search I want everything displayed on a combo box (e.g 123 Manin Street North)

Something like this:

Private Sub AddressSearch()
dim Address as string
Address = "StrAdd LIKE '" & UCase$(txtAddress.Text) & "%'" +

End Sub

Do While Not records.EOF
cboCandAddress.AddItem records.Fields("StrAdd").Value
cboCandAddress.ListIndex = 0

Any help is greatly appreciated

Concatenate With Spacing
How do you concatenate two strings into a list box with spaces between the concatenation. IE, I want to put two string values together using a loop function. Each time it loops it concatenates the two stings and displays them in a list box. Is there something I can use to make the two strings equi-distant apart giving a table-look? Thanks...

How Do You Concatenate Two Columns Into One?
I am using an access database , vb6 platform and an adodc control to join them . I have two columns ,table and fname ,say. I want to create an sql query to get an output of the form "table.fname" for a specific tablename.Both are of string types .

How To Concatenate String?

how can i get the BALAGAN in Text1.Text, MARIBETH in Text2.text, and PINEDA in Text3.Text.

thanks in advance

How Can I Concatenate ADO Recordsets
I am looking for a way to concatenate 9 ADO recordsets into one , or to put the queries within them into one recordset. I have select queries, which I need to put into one for use in a report. Is their a simple way to do this.
Thanks for any help

Concatenate Fields
sql server 7, vb6.

I need to string together delivery note numbers in a query.  The table contains

Order   Delivery Note number
1       Order1Del1  
2       Order2Del1  
1       Order1Del2  
1       Order1Del3  
2       Order2Del2  
3       Order3Del1

And I want to end up with

Order   Delivery Note number
1       Order1Del1 Order1Del2 Order1Del3     
2       Order2Del1 Order2Del2   
3       Order3Del1

I can't see how to do this short of a nasty loop.

Concatenate Excel Sheets
I have around 25 Excel sheets created of the same Template.
Using a Macro or from VB can i create a sheet that would be the cocatenation of all the 25 sheets i.e one sheet below another(not side by side) for eg Sheet1, followed by sheet2 , followed by sheet3 and so on.

Will be very greatful , if i can get a sample code.

Thanks a lot

Concatenate W/in Sheet Name While Linking....
Concatenate w/in sheets name while linking the cell back to another sheet tab.


Here is what I have....
And I want to pick the number 9 in B4 as a variable

Trying to pick up data in cell b4 is what is not working....

How do I do this???????


Concatenate VBA Results And An * In A Cell

I would like to concatenate the results of copying a cell and adding an * to left of the number value, in the same cell.

For example, it would look like Range("B1").Value = "*" + Range("A1").Value .
But it does not work. For sure, trying to mathematically sum a String and a number isn't a good idea in the form I've just written. So I imagine I would have to convert the number into String. How, I'd like too know. But then, if I want to use again the value in B1 (so removing the * in VBA and do maths with those numbers), how could I reverse this process?



Concatenate Across Multiple Worksheets

My function doesn't seem to work. I need to concatenate the text strings from a range of cells from all worksheets in the workbook. I can't figure out what I'm doing wrong here.

Function ConcatenateAllWS(InputRange As Range) As String

Dim ws As Worksheet, Temp1 As String, Temp2 As String
Application.Volatile True
For Each ws In ActiveWorkbook.Worksheets
If ws.Name <> ActiveSheet.Name Then
Temp1 = Application.WorksheetFunction.Concatenate(ws.Range(InputRange.Address))
End If
Temp2 = Application.WorksheetFunction.Concatenate(Temp2, Temp1)
Next ws
Set ws = Nothing
ConcatenateAllWS = Temp2
End Function
Also is there any way to add a comma in between each cell's text?


Specific CONCATENATE Across A 3D Range
This one is a doosie, and I've run out of places for help.

The data results from a survey are compiled several workbooks with multiple spreadsheets. Each workbook consists of a Calculation/Summary sheet and many (anywhere from 3 to 30?) sheets, which are the direct submissions of the survey. All the data of the survey is lined up to match the same ranges (e.g.: the answer to arbitrary question X is in the same cell address on all sheets)

Each question asks for a rating from 1.00 to 5.00, and comments. The goal of the summary page is to display the max/min rating for each question, which survey participants marked a max/min rating, and what their comments are.

To display a single max/min in a range (even a 3D range) can work as simply as using the MAX(range) or MIN(range) functions.

Other suggestions I've received is to just write a long CONCATENATE function in the objective cell. However, every month the participants of the survey change, and the formula would have to be rewritten, so I can't just write something like this:

=IF(Sheet2!C5=MAX(Sheet2:Sheet17),Sheet2!C6&", ","")&IF(Sheet3!C5=MAX(Sheet2:Sheet17),Sheet3!C6&", ","")&IF(Sheet4!C5=MAX(Sheet2:Sheet17),Sheet4!C6&", ","")&.....
However, looking at this, the entire IF(...) function is repeated, solely with the change of the objective sheet for each repitition, isn't there a way to iterate this and automate the grabbing off of the numerous amorphous spreadhseets?

I've never coded in Excel VBA, but I'm quite seasoned in Access VBA and VB6, which is why I haven't successfully written a macro or chunk of code to accomplish this seemingly simple task. Can anyone help?

Concatenate Decimal Point
I'm writing a program that uses an onscreen numeric keypad and I have used the following code on each of button to build the number on each key press.

Dim Number As Single

Number = Number & 1
TextBox1.Text = Number

Obviously 1 would change to 2 etc. depending on the button pressed.

My question is how do you then add a decimal point?

You can't just change Number = Number & . or Number = Number & "." because the variable is a Single.

Do I have to use a string and then convert back to a number?

Please tell me if I'm doing something really stupid, I am new at this.

Thanks in advance

How To UN-Concatenate The Previously Concatinated Value
I am useing the following code to contatenate the fields. Can someone please tell me how to UN-Concatenate it back the way it was. that is 2 seperate fields. thanks.

Dim i As String
Do Until myRecordset.EOF
i = ""
i = (myRecordset.Fields("OrganizationID").Value) & vbTab & (myRecordset.Fields("OrganizationName").Value)
MSFlexGrid1.AddItem i
' MSFlexGrid1.AddItem CStr(myRecordset.Fields("OrganizationName").Value)

Concatenate Then Parse A Combo
I am trying to display two fields in one combo box then totally change it to reflect the value of a different field. The reason for this is to make it easy for date entry personnel to recognize a material code instead of having to know construction lingo to enter the bills.

The fields I need displayed in the combo box are MatCross and Description. The MatCross is a cross reference to equal the Phase Field in the same table. Is there a way to do this?

Private Sub Form_Load()

Dim strSQL As String

' Set the SQL statement and open the recordset
strSQL = "SELECT MatCross & ' - ' & Desc AS MatDesc FROM tblPhase WHERE MatCross > 0 ORDER BY MatCross"
rs.Open strSQL, cn, adOpenForwardOnly, adLockReadOnly

'Insert numbers from the tblPhase field MatCross and Desc into the combo boxes
Do Until rs.EOF
cboPhase.AddItem sTrapNull(rs.Fields("MatDesc"))

' Close the recordset

' Open the tblActual Table for data entry
strSQL = "SELECT * FROM tblActual ORDER BY EntDate"
rs.Open strSQL, cn, adOpenKeyset, adLockPessimistic
'optEntDate.Value = True

End Sub

Private Function sTrapNull(ByVal parameter As Variant) As String

' Trap any Null values that reside in a table for
' prefilling the combo boxes
If IsNull(parameter) Then
sTrapNull = 0
sTrapNull = parameter
End If

End Function

Private Sub cmdOK_Click()

' Map UI controls to fields.
rs.Fields("EntDate") = dtpEntDate
rs.Fields("Invoice") = txtInvoice
rs.Fields("JobNum") = cboJobNum
rs.Fields("Phase") = cboPhase ' This is the field I want the MatCross & Desc Field to convert to.
rs.Fields("Amount") = txtAmount
rs.Fields("Category") = cboCategory
rs.Fields("Note") = txtNote

' Commit data to database.

End Sub

Concatenate Two Fields In A Query
this how to concatenate two fields in a query
Sample: [field1] & " " & [field2]
but i want the field2 value is in the next line. is it possible? i try to put vbcrlf but it prompts me an error. any idea on how to do this? because these two fields has a large of data.

any result really appreciated. thanks in advance


VB has the possiblity to insert some Excel functions with application.worksheetfunction.

But how about the Excel function "INDIRECT" ?

I want to do something like:

UserForm.TextBox & 1.Visible = True
UserForm.TextBox & 2.Visible = True
and so on


Byte Arrray Concatenate
Hi, having some difficulty with concatenating a byte array. Basically i'm trying to insert the contents of multiple files into a single byte array. This is the code i'm using currently:
For i = 0 To lstFiles.ListCount - 1
Open lstFiles.List(i) For Binary Access Read Lock Read As #1
Get #1, , filesData
Close #1

filesData is obviously the byte array which has already been declared and set to the exact size of all the files listed in the listbox. When this code is executed it only writes the contents of the last file to filesData. A solution would be much appreciated.

Problem With Concatenate *** RESOLVED ***
I have a line of code:

Range(FinalRng.Cells(y, 1), FinalRng.Cells(y, 1)).PasteSpecial Paste:=xlValues

This much works fine and it pastes a variable, say 268 into specified cell. I want to append the following:


to make it "268.tif". But I can't seem to get it right when included in the line of code. I do NOT want to make it a hyperlink, just plain text. I tried 18 different ways so I know what does not work, but I would really like to find a way to make it fly...

Concatenate Values If They Exist!
I have a text box on my report with the ControlSource:
=[Address] & ", " & [Address2] & ", " & [Address3] & ", " & [City] & ", " & [County] & ", " & [PostalCode] & ", " & [Country]

Some of the input Text Boxes are empty, so the end result looks like this

31 Trundle street, , , Surrey, ,

Is there any way I can remove the commas if the value does not exist in the input text boxes. (i.e.) =IfExists[Address] & "," & etc.


Concatenate To Recordset Statement
I want to set my string variable equal to my recordset field. However I would like store the recordset field to a variable so that if the name of field changes I won't get any errors.

I've tried to concatenate the recordset field variable to the recordset statement, but doesn't work.

ie.) strTerr = rstTerr! & strField

Any help would be appreciated

Get A Value From The Registry And Concatenate With Other Strings

I try to retrieve the path of my java interpreter from the window registry and then concatenate this path with some other strings so as to run my java program. I always loss the second part of my string. This is my code:

' get the path from registry
Dim javaBuffer as String

javaBuffer = GetStringValue("HKEY_LOCAL_MACHINESoftwareJavaSoftJava Runtime Environment1.2", "JavaHome")

javaBuffer = Trim(javaBuffer)
tempvar = javaBuffer + "injava -classpath..."

'run my java program
Shell tempvar (+ some other arguments)

I notice that tempvar does not contain "injava..." at all even if I do the simple string concatenation as shown in the code above. The value obtained from the registy, though, is correct. Any ideas?


How Can I Concatenate Two Text And Then Separete Then As Two

I am facing problem where I have to concatenate two text value i.e. -2.05, -3.05. Then after storing back to the access database through VB-6. I have to separete them as two fro comparision.
Pls note that the length of the value is not fixed but separeter is "," . May I get the solutions then pls let me know unless send me the alternative.


I have report in vb6.I have data environment and 2 commands. Commands2 has such fields: field1,field2,field3,field4,field5,field6.I'd like to concatenate field1,field2,field3 in one RptTextBox. For example:field1=02,field2=03,field3=971 and result should be RptTextBox=0203971                                                                                                         Thanks                                                           



How To Add 2 Fields In A Datacombo(concatenate)
Hi, I am trying to concatenate 2 fields as one then add it to a datacombo, but i tjust ain't working.
this is what i have done...

adoCreateJob.RecordSource = "SELECT NUser.UFirstname + ' ' + NUser.ULastName As UName,NUser.UserID " _
                              & "FROM NUser " _
                              & "ORDER BY " & DataField & " ASC"
    Set dcUser.DataSource = adoCreateJob
    Set dcUser.RowSource = adoCreateJob
        dcUser.ListField = DataField
        dcUser.BoundColumn = "UserID"

the datafield is a variable that decides whether to return the result by username or userID....The datafield is determined prior when the user selects an option button.


Concatenate Fields And Compare With A Third One

Can u tell me how do i concatenate fields
eg :
table1 : address_bk
Area_code char 3
phone char 7

table2 : phone
tel_no char 10

I want to concatenate both the fields in table1 , compare the results with table2 tel_no field and delete records from 1st table which are present in 2nd table...!

I use VB 6.0 as front end and SQL 7.0 as backend..!


Concatenate BINARY Files
Does anybody have any code that can concatenate BINARY files?

Concatenate Text Files
I am trying to concatenate two text file through VB in order to read one file in with ADO 2.5. I do now want to read in line by line but more of a copy file.
Does anybody know how to concat. a second file on to a current file(or just create a third file with the concat already done).
Thank you in advance.

How To Concatenate String To Memo
Hello all,

I am desparately trying to concat a string field to a memo field and output the result into a text file or use it in a query. The problem is that, whatever I do, the result of the concatenation is cut off after 255 characters.

Table 1:
Title: string - 128 chars
Description: memo

Query 1:
TitleDescription: [Title] & " - " & [Description]

The famous dictionary of computer terms - This book covers a wide range of ......... and expl
Access for beginners - An easy introduction into the world of databases ....... with many illustr

The output always cuts off. If I try the same in a module and write some code using Print #1 or Put #1 or something like that, the result is still cut off. I tried to use GetChunk(offset, size) but that always returned the beginning of the memo field and not chunks from inside the memo field.

Here is my code:

public Function OutputToActinicCatalog()

DoCmd.Hourglass true

' Open query "Output to Actinic Catalog"
Dim DB as Database
Dim Records as Recordset

set DB = CurrentDb

' get contacts
set Records = DB.OpenRecordset("Output to Actinic Catalog")

' Create CSV file
Open CurrentProject.Path & "Output to Actinic Catalog.txt" for Output Access Write as #1

Dim Output, I as Long
Dim Newline as string, Quote as string, Comma as string

Newline = Chr$(13) & Chr$(10)
Quote = """"
Comma = ","

Output = ""

While Not Records.EOF

' Write memo field to file
for I = 0 to Records.Fields("Description").FieldSize - 1 step 255
Output = Records!Description.GetChunk(I, 255) ' This ALWAYS returns the FIRST(!!!) 255 characters - why?
print #1, Output
next I



Close #1

DoCmd.Hourglass false

End Function

Any help would be much appreciated.


Hope this helps?

Concatenate In Crystal Report

How can I concatenate data in a field? Example, I got an output of data that print out on the report as one data per row:
and I want it to look like
20, 25, 41, 56

The number of data in the field various.


Efficiency Of Concatenate Long String
I know that with using the & to concatenate a very long string in looping will take quite some long time.

Is there any effiency for me to do the concatenate of long string instead of uising '&'?


Copyright Đ 2005-08, All rights reserved