Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

vbCrLf does not work in MS Work in Macro / Document Template

Posted on 2006-10-24
13
Medium Priority
?
237 Views
Last Modified: 2013-12-25
I need the following to have 3 seperate paragraphs.
I've tried a lot of things, nothing works for me.
I'm a bit green to VB, but I cannot locate the proper syntax to put carraige returns and line feeds where I need them.
The example below puts everything on one blurb of text.
(it's part of my complete script, it's this part I need to break into 3 paragraphs).
--------------------------------------------------------------------------------------------------
If strSalesman = "BOB" Then
        Selection.TypeText Text:="As I mentioned, we have an experienced chemical " _
        + "engineer on staff who is available for emergencies or consultations, day or night." _
        + "I am intimately involved with every aspect of our operations " _
        + "planning and quality control.  Our competence and service, backed " _
        + "by thorough supervision on every job, are in the forefront of our industry." _
        + "Our company was founded to service discerning organizations, " _
        + "like yours and if given the opportunity to service your facilities, " _
        + "I will not let you down.  You have my personal guarantee."

        Selection.GoTo What:=wdGoToBookmark, Name:="bkrep"
        Selection.TypeText ("Mighty Mouse")
    End If
--------------------------------------------------------------------------------------------------

THIS IS THE EXACT LAYOUT I NEED:

As I mentioned, we have an experienced chemical engineer on staff who is available for
emergencies or consultations, day or night.

I am intimately involved with every aspect of our operations planning and quality control.  
Our competence and service, backed by thorough supervision on every job, are in the
forefront of our industry.

Our company was founded to service discerning organizations, like yours and if given the
opportunity to service your facilities, I will not let you down.  You have my personal
guarantee.

--------------------------------------------------------------------------------------------------

Can anyone help?

Thanks much in advance.
0
Comment
Question by:guruuno
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +2
13 Comments
 
LVL 66

Expert Comment

by:Jim Horn
ID: 17799626
This doesn't work?

Selection.TypeText Text:="blah blah blah " & vbCrLf  _
    + "blah blah blah." & vbCrLf _
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 17799630
Or use chr(13) in place of vbCrLf
0
 
LVL 1

Author Comment

by:guruuno
ID: 17800093
I found that by Google-ing, and it does not work.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:JackOfPH
ID: 17800781
try
Selection.TypeText Text:="blah blah blah " & vbcr + vblf  _
    + "blah blah blah." & vbcr + vblf
0
 
LVL 1

Author Comment

by:guruuno
ID: 17800890
I tried as below, did not work.  Also, on the LAST line, how do I get the carraige return/line feed? (in addition to the areas I added the  & vbcr + vblf  _)
(+ "I will not let you down.  You have my personal guarantee.")
As, if I add anything after ......personal guarantee.", I get a compile error.
-------------------------------------------------------------------------------------

If strSalesman = "BOB" Then
        Selection.TypeText Text:="As I mentioned, we have an experienced chemical " _
        + "engineer on staff who is available for emergencies or consultations, day or night." & vbcr + vblf  _
        + "I am intimately involved with every aspect of our operations " _
        + "planning and quality control.  Our competence and service, backed " _
        + "by thorough supervision on every job, are in the forefront of our industry." & vbcr + vblf  _
        + "Our company was founded to service discerning organizations, " _
        + "like yours and if given the opportunity to service your facilities, " _
        + "I will not let you down.  You have my personal guarantee."

        Selection.GoTo What:=wdGoToBookmark, Name:="bkrep"
        Selection.TypeText ("Mighty Mouse")
    End If
0
 
LVL 15

Expert Comment

by:JackOfPH
ID: 17801224
Try using the "&" instead of + as connector...
If strSalesman = "BOB" Then
        Selection.TypeText Text:="As I mentioned, we have an experienced chemical " _
        & "engineer on staff who is available for emergencies or consultations, day or night." & vbcr + vblf  _
        & "I am intimately involved with every aspect of our operations " _
        & "planning and quality control.  Our competence and service, backed " _
        & "by thorough supervision on every job, are in the forefront of our industry." & vbcr + vblf  _
        & "Our company was founded to service discerning organizations, " _
        & "like yours and if given the opportunity to service your facilities, " _
        & "I will not let you down.  You have my personal guarantee."

        Selection.GoTo What:=wdGoToBookmark, Name:="bkrep"
        Selection.TypeText ("Mighty Mouse")
    End If
0
 
LVL 6

Expert Comment

by:saravananvg
ID: 17801276
Hello Sir,

  Check the following sample.

strMessage = "The WOL packet was sent:" & vbcrlf & vbcrlf _
   & "Packet Status:" & vbTab & strStatus & vbcrlf _
   & "Broadcast Address:" & vbTab & strBroadcastAddr & vbcrlf _
   & "MAC Address:" & vbTab & strMACAddr & vbcrlf _
   & "Using Interface:" & vbTab & strLocalIP


In the samples already post above, I think it should be &vbcrlf & vbcrlf_      instead of vbcr + vblf_

with regards,
padmaja.
0
 
LVL 1

Author Comment

by:guruuno
ID: 17803126
Tried both of the last 2 examples, still a no go.
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 17803231
Another method to try...

Dim strMessage as string

strMessage = "blah blah blah " & vbCrLf
strMessage = strMessage & "blah blah blah blah blah blah blah " & vbCrLf
strMessage = strMessage & "blah blah blah blah blah blah blah " & vbCrLf
strMessage = strMessage & "blah blah blah blah blah blah blah " & vbCrLf
strMessage = strMessage & "blah blah blah blah blah blah blah " & vbCrLf

YourControl.YourProperty = strMessage
0
 
LVL 1

Author Comment

by:guruuno
ID: 17803251
I got it to work with the following, thanks for all, but I haced all night to get it.
=================================================
If strSalesman = "BOB" Then
        Selection.TypeText Text:="As I mentioned, we have an experienced chemical " _
        + "engineer on staff who is available for emergencies or consultations, day or night." & vbCrLf _
       
        Selection.TypeParagraph
        Selection.TypeText Text:="I am intimately involved with every aspect of our operations " _
        + "planning and quality control.  Our competence and service, backed " _
        + "by thorough supervision on every job, are in the forefront of our industry." & vbCrLf _

        Selection.TypeParagraph
        Selection.TypeText Text:="Our company was founded to service discerning organizations, " _
        & "like yours and if given the opportunity to service your facilities, " _
        & "I will not let you down.  You have my personal guarantee." _

        Selection.GoTo What:=wdGoToBookmark, Name:="bkrep"
        Selection.TypeText ("Mickey Mouse")
    End If
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 18184077
PAQed with points refunded (250)

Computer101
EE Admin
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question