|
-
Sep 9th, 2005, 06:19 AM
#1
Thread Starter
Junior Member
too long string
i am getting "too long string" error from the following code from line with exclamation mark. In this textbox i am typing the text which is about 3 to 5 lines. how can i get rid of this error
Private Sub cmdDoc_Click()
Dim wordapp As Word.Application
Dim thisdoc As Document
Dim thisrange As Range
Set wordapp = CreateObject("word.application")
If wordapp Is Nothing Then
MsgBox "could notstart word"
End If
wordapp.Documents.Open ("C:\documents and settings\administrator\application data\microsoft\templates\C-00.dot")
Set thisdoc = wordapp.ActiveDocument
thisdoc.FormFields(1).Result = txtName.Text
thisdoc.FormFields(2).Result = txtFNo.Text
thisdoc.FormFields(3).Result = txtRef.Text
thisdoc.FormFields(4).Result = txtNo.Text
thisdoc.FormFields(5).Result = txtSite.Text
thisdoc.FormFields(6).Result = txtMic.Text ??????
thisdoc.FormFields(7).Result = txtDiag.Text
please help me
-
Sep 9th, 2005, 06:49 AM
#2
Lively Member
Re: too long string
2-3 lines I am guessing is over 255 characters long in your case: Some info from msdn: http://support.microsoft.com/default...b;en-us;181110
-
Sep 9th, 2005, 10:44 AM
#3
Re: too long string
I dont see how MS thinks that removing characters to make it fit to 255 is a "workaround"
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 9th, 2005, 10:55 AM
#4
Re: too long string
a real work around is to Redim an array of strings
Code:
Dim Lenght as long, Count as Long
Dim Arr() as String
Length = len(YourObjetsText)
Redim Arr(Length/255)
for Count = 0 to Length
Arr(Count) = mid$(YourObjetsText,Count* 255,255)
next
 why can't programmers keep and 31 Oct and 25 dec apart. Why Rating is Useful
for every question you ask provide an answer on another thread.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|