Solved

Another Easy Word-VB Question

Posted on 2000-03-15
7
211 Views
Last Modified: 2010-05-02
Allright.  I am having VB place text  in my word document that I'm formatting to be centered.  After it does this, I need to go to the end point of that insert, move down 2 lines, and begin inserting again, but formatted to the left like a normal text.  The way I have it set up is that I can't break the selection and it continues to format center.

I'd like to find a command that releases the current selection and starts a new selection where the cursor is currently at.  Any ideas?

rick

ps:  I'm using word visual basic, not the full version of it.
0
Comment
Question by:saksafon2
  • 4
  • 2
7 Comments
 

Expert Comment

by:gogs
ID: 2620165
1. start recording a macro
2. perform the required action
3. stop recording the macro
4. edit the created macro to see the required calls.
0
 

Author Comment

by:saksafon2
ID: 2620177
Edited text of question.
0
 

Author Comment

by:saksafon2
ID: 2620181
I'm not talking anything about macro's in this situation.  I need VB code that will stop selecting and start a new one.. sorry..

rick
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 10 total points
ID: 2620323
I assume that appWord is a reference to the Word Appliation and that the document is currently selected:
  appWord.Selection.Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
  appWord.Selection.TypeText "THIS IS CENTERED" & vbCrLf & vbCrLf
  appWord.Selection.Range.ParagraphFormat.Alignment = wdAlignParagraphLeft
  appWord.Selection.TypeText "THIS IS LEFT" & vbCrLf
0
 

Author Comment

by:saksafon2
ID: 2620390
It doesn't work in Word Basic.  What happens is the centering command centers the first comment and then the left commadn left's the entire paragraph, both of them.  I'm looking for the way to:

1.  Write the 1st paragraph
2.  Center the first paragraph
3.  Release the selection
4.  Write the 2nd paragraph
5.  Left the 2nd paragraph

it's the release part that's making this difficult.

meh!

rick

0
 

Author Comment

by:saksafon2
ID: 2620417
Hm.  I played with it and somehow I think what you said led to me fixing my problem in some odd way.  Anyways.

Thanks.

rick
0
 

Expert Comment

by:gogs
ID: 2621787
i just meant that by reading the wordbasic commands in the macro created you will be able to see how to unselect text and therefore be able to apply the new formatting to the next paragraph from withing the vb wordbasic calls.

Gogs
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

856 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