473,398 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

WordBasic --- Insert command text limit

a
I am using following code to insert text into the word document, using VB
from excel.

Any text which has length more than 240 characters is not getting inserted
into the document.

Any suggestions, if highly appreciated.

Thanks,
----------------------------------------------------------------------------
------------------------------------

Sub GenerateADRFinding()

' Dimension the variables.
Dim PokeRange As Object
Dim Chan As Integer
Dim i As Long
Dim temps As String
Dim insertS As String

' Create an range object to poke.
Set PokeRange = Range("CheckList!a1")

' Initiate a channel to Word using a file as the topic.
Chan = DDEInitiate("WinWord", templateFile)

' Execute a few WordBasic commands.
DDEPoke Chan, "\StartOfDoc", PokeRange

i = 0
Do While i < 240 9 '(> 240 does not work)

temps = temps & "1"
i = i + 1
Loop

insertS = "[Insert "" " & temps & " "" ]"""

DDEExecute Chan, insertS
'DDEExecute Chan, "[FileSaveAll]"
DDEExecute Chan, "[FileExit]"

' Terminate the DDE channel.
DDETerminate Chan
Nov 21 '05 #1
1 3783
You need to use a string builder object instead of the string object.
Imports System.Text

dim str as new StringBuilder

i = 0
Do While i < 999

str.append("1")
i = i + 1
Loop
msgbox(str.toString)

"a" <a@abc.com> wrote in message
news:O7**************@TK2MSFTNGP10.phx.gbl...
I am using following code to insert text into the word document, using VB
from excel.

Any text which has length more than 240 characters is not getting inserted
into the document.

Any suggestions, if highly appreciated.

Thanks,
-------------------------------------------------------------------------- -- ------------------------------------

Sub GenerateADRFinding()

' Dimension the variables.
Dim PokeRange As Object
Dim Chan As Integer
Dim i As Long
Dim temps As String
Dim insertS As String

' Create an range object to poke.
Set PokeRange = Range("CheckList!a1")

' Initiate a channel to Word using a file as the topic.
Chan = DDEInitiate("WinWord", templateFile)

' Execute a few WordBasic commands.
DDEPoke Chan, "\StartOfDoc", PokeRange

i = 0
Do While i < 240 9 '(> 240 does not work)

temps = temps & "1"
i = i + 1
Loop

insertS = "[Insert "" " & temps & " "" ]"""

DDEExecute Chan, insertS
'DDEExecute Chan, "[FileSaveAll]"
DDEExecute Chan, "[FileExit]"

' Terminate the DDE channel.
DDETerminate Chan

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: alexmaster_2004 | last post by:
hi i have made an application using C# that access sql2000. this application is just used to insert data to the database. i use something like this in my code: // string colmnA = TextBox1.Text;...
6
by: Lelle | last post by:
Hello ! how can i insert text containg code examples from a textbox into a database using SQL insert statment. i have no problem to just add text that dont contains code and script examples...
3
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all...
7
by: Milos Prudek | last post by:
I need to insert a value = max(value)+1, where max is a select limited by a 'where' clause. Like this: INSERT INTO table (idthread, idsection,txt) VALUES ( (SELECT max(idthread)+1 FROM table...
1
by: Ed Dror | last post by:
Hi there, I have ASP <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Guestbook.aspx.vb" Inherits="Guestbook" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
8
by: Martin Z | last post by:
INSERT INTO dbo.Transmission (TransmissionDate, TransmissionDirection, Filename, TransmittedData) VALUES (@TransmissionDate,@TransmissionDirection,@Filename,@TransmittedData); SELECT @retVal =...
1
by: skanemupp | last post by:
in this program when using the "c"-button it deletes the last token entered. i want to delete the token after the mousecursor. lets say the string is: 12*(81**.5+12) and i put the cursor between...
5
by: =?Utf-8?B?bXBhaW5l?= | last post by:
Hello, I am completely lost as to why I can't update a DropDownList inside a DetailsView after I perform an insert into an object datasource. I tried to simply it down to the core demostration:...
3
by: pavanponnapalli | last post by:
hi, I have designed a module, which contains a template for insert command. The code is as under: my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.