ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   WordBasis insert command -- text length limit (https://www.excelbanter.com/excel-programming/313965-wordbasis-insert-command-text-length-limit.html)

a

WordBasis insert command -- text length limit
 
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 are 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





No Name

WordBasis insert command -- text length limit
 
this is an excel newsgroup. you may have better luck
posting in the word newsgroup.

-----Original Message-----
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 are 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




.



All times are GMT +1. The time now is 10:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com