Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / October 2004

Tip: Looking for answers? Try searching our database.

WordBasic --- Insert command text limit

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
a - 19 Oct 2004 04:19 GMT
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
Brad Shook - 19 Oct 2004 16:25 GMT
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)

> I am using following code to insert text into the word document, using VB
> from excel.
[quoted text clipped - 41 lines]
>       ' Terminate the DDE channel.
>       DDETerminate Chan

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.