|
-
Jul 10th, 2006, 12:21 PM
#1
Thread Starter
Member
Enter between Lines
Hi Experts!!
I am stuck please help me!
Could you please let me know how can I insert enter between lines?
for example
I am storing some text in a varialble and I want after few characters rest of the characters should come in next time. Like we use \n in c and java.
What can be used in VBA Code?
tex="Hello how are you doing? what'up?"
I want when i print this code in excel sheet I "What's up" should come in the next line?
Thanks,
-
Jul 10th, 2006, 12:26 PM
#2
Re: Enter between Lines
Weel to enter in line breaks you would do this.
VB Code:
tex="Hello how are you doing?" & vbNewline & "what'up?"
But Im just assumming that you already have the Excel part done. You may have to enable the word wrapping in Excel though.
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 
-
Jul 10th, 2006, 12:26 PM
#3
Re: Enter between Lines
VB Code:
tex="Hello how are you doing?[B]" & vbCrLf & "[/B]what'up?"
'or
tex="Hello how are you doing?[B]" & vbNewLine & "[/B]what'up?"
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jul 10th, 2006, 12:27 PM
#4
Re: Enter between Lines
Beat you Static
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 
-
Jul 10th, 2006, 12:28 PM
#5
Re: Enter between Lines
Use the vbNewLine constant.
Edit:
-
Jul 10th, 2006, 12:30 PM
#6
Re: Enter between Lines
Rob.. ahh.. well thats cause you took the cheap way out and did not give a thurough answer!! cheater!! lol
penagate - No.. use the vbCrLf!!!
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jul 10th, 2006, 12:33 PM
#7
Re: Enter between Lines
Actually I believe vbNewLine is better as it is defined as a platform independent new line constant. vbCrLf is a hardcoded CR + LF sequence.
Could be wrong though.
-
Jul 10th, 2006, 12:33 PM
#8
Re: Enter between Lines
Static: I did give the answer and c0d. 
PG: thats what happens when you use that smiley too much, you get slow 
There is no difference between vbNewLine and vbCrLf. They are the same, only up to your personal preference but vbNewLine is better
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 
-
Jul 10th, 2006, 12:38 PM
#9
Re: Enter between Lines
yep looked in the object browser.. they are the same.. but vbCrLf just looks so much more cryptic.. that makes it better
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jul 10th, 2006, 03:45 PM
#10
Re: Enter between Lines
 Originally Posted by RobDog888
There is no difference between vbNewLine and vbCrLf. They are the same, only up to your personal preference but vbNewLine is better 
How?
Can you show an example or something?
-
Jul 10th, 2006, 03:51 PM
#11
Re: Enter between Lines
Yeah? how is it better?
--- still waiting!
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jul 10th, 2006, 03:58 PM
#12
Re: Enter between Lines
In Windows they're both Chr(13) & Chr(10). If MS ports VB to *nix, vbNewLine would be Chr(10)
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Jul 10th, 2006, 04:38 PM
#13
Re: Enter between Lines
 Originally Posted by Static
Yeah? how is it better?
Readibility in your code and like I posted, its a personal preference but you should all do as I say without question 
From the immediate window....
VB Code:
?asc(mid$(vbnewline,1,1)) & " - " & asc(mid$(vbnewline,2,1))
13 - 10
?asc(mid$(vbcrlf,1,1)) & " - " & asc(mid$(vbcrlf,2,1))
13 - 10
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 
-
Jul 11th, 2006, 07:26 AM
#14
Thread Starter
Member
Re: Enter between Lines
Thanks a bunch it wouked out.
However when I use & vbnewline it breaks the line and enters one space before the first character of next line.
Example
This is first line
this is second line
One more question. Is there any function to bold/italic the text
-
Jul 11th, 2006, 10:42 AM
#15
Re: Enter between Lines
 Originally Posted by vikasbhandari2
However when I use & vbnewline it breaks the line and enters one space before the first character of next line.
Example
This is first line
this is second line
Make sure you're not telling it to include that space. vbNewLine has no space in it.
One more question. Is there any function to bold/italic the text
Not in a variable, since it wouldn't make sense - bold and italic are display properties, not properties of the text.
If you want to display the text as bold or italic in a text box, it all has to be bold or italic (or both). If you want just some characters changed you'd have to display it in a rich text box.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Jul 11th, 2006, 10:49 AM
#16
Thread Starter
Member
Re: Enter between Lines
I am using Rich Text box, what options I have to make them bold.
I want some of the words should come in bold!!
Thanks in advance!!!
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
|