|
-
Jun 10th, 2005, 05:35 AM
#1
Thread Starter
Junior Member
How to format inserted text?
Hi All
I have a Word application that enables me to get data from a database and insert them into certain fields of the Word table. However the inserted text should be formatted as separate lines one line after the other, not
continuously. Could anyone help me on this? Thanks in advance.
Claire
-
Jun 10th, 2005, 12:51 PM
#2
Re: How to format inserted text?
Post your code, but the logic would be to use a vbNewline or vbCrLf (they are the same actually) to create a line break and
position the next text on the next line.
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 
-
Jun 10th, 2005, 03:54 PM
#3
Thread Starter
Junior Member
Re: How to format inserted text?
Hi Robdog888
Here is my code:
VB Code:
sqlstring="Select Description from employee Where CompanyName= " & cname & ""
Set rstEmp=dbs.OpenRecordset(sqlstring)
Do While Not rstEmp.EOF
If IsNull(rstEmp.Fields("Description").Value=False then
Description=rstEmp.Fields("Description").Value
else
Description=""
end if
for num=1 to maxnum
with myTable
.cell(num,1).Range.InsertAfter(Description)
End With
Next num
rstEmp.MoveNext
Loop
I want to add code right after the line:
VB Code:
.cell(num,1).Range.InsertAfter(Description)
that enable the next line not continuous, but start a new line.
Thanks in advance
Claire
Last edited by clairexh; Jun 13th, 2005 at 07:55 AM.
-
Jun 10th, 2005, 04:07 PM
#4
Thread Starter
Junior Member
[Resolved] Re: How to format inserted text?
Hi robdog888
After I posted my code, I tried add vbnewline into the line:
VB Code:
.cell(num,1).Range.InsertAfter(Description & vbnewline)
it works perfectly, thanks a lot. I spent quite long hours to try to figure out.
Cheers
Claire
Last edited by clairexh; Jun 10th, 2005 at 04:12 PM.
-
Jun 10th, 2005, 04:30 PM
#5
Re: How to format inserted text?
Sorry for the delay in getting back to you.
Good job and Thanks
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 
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
|