[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 335
  • Last Modified:

Right-aligning a shape in Word97

I'd like to align a shape (typically a bitmap image) that is not in-line(!) flush right on a page or in a text column. Word6 could do this. Word97 can't (at least I have found no way to do so). I have tried lots of things. I can right-align a shape on a "plain" page, but text columns give me a big headache. So if there is no "easy" solution that I simply overlooked, please focus on aligning an image (not in-line!) right in the second (!) column of 3 on a page when the columns have different widths.

Thanks in advance,
Wolfgang <><
0
hutter
Asked:
hutter
  • 9
  • 3
  • 2
  • +2
1 Solution
 
tureCommented:
I'm using Word 2000, doing this without problems.

1. I create a three-column document with different sized columns.

2. I type some text into columns 1 and 2, with a column break to end column 1.

3. I insert a clip-art picture into column 2.

4. Double-click the clip-art, and set:
Layout tab: Wrapping style: Tight, Horizontal Alignment: Right.

Done!

Ture Magnusson
Karlstad, Sweden
0
 
tureCommented:
Wolfgang,

I tried the procedure in Word 97, and noticed that there are not the same possibilities there. A reason to upgrade to Word 2000...

/Ture
0
 
eal4Commented:
Ture and Wolfgang,
In Word 97, you have to go to Format, Object in order to accomplish what you wish. Try it out.
Ed
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
tureCommented:
Ed,

I have done that, but the formatting options are not the same as in Word 2000. I can't find a way there to set the picture's horizontal alignment to Right.

/Ture
0
 
hutterAuthor Commented:
Ture,

upgrade??? Downgrade!!! As I said: it was possible in Word97!

I crossposted this question to the VBA area and am hoping for additional insight from there...
0
 
tureCommented:
hutter,

You wrote "Word6 could do this".

Word 97 can't (or at least not in a way that I know of). That's not good.

Word 2000 does it, nicely and easily. That IS an upgrade from Word 97!

/Ture
0
 
tureCommented:
Wolfgang,

As you have posted your question also in the VB topic area, can I assume that a VBA solution is OK? Like selecting the image and then running a VBA procedure to position the selected image correctly?

/Ture
0
 
tureCommented:
Wolfgang,

This VBA procedure right-aligns an image within a column:

Sub PutImageRightAlignedInColumn()
  Dim img As ShapeRange
  Dim col As TextColumn
  Dim colLeft As Long
  Dim colRight As Long
 
  Set img = Selection.ShapeRange
  img.RelativeHorizontalPosition = wdRelativeHorizontalPositionMargin
 
  For Each col In ActiveDocument.PageSetup.TextColumns
    colRight = colLeft + col.Width
    If img.Left >= colLeft And img.Left <= colRight Then
      img.Left = colRight - img.Width
      Exit Sub
    End If
    On Error Resume Next
    colLeft = colRight + col.SpaceAfter
    On Error GoTo 0
  Next col
End Sub

/Ture
0
 
hutterAuthor Commented:
cross-post from VBA area

Hi Ture,

                      not bad. But I see that you seem to have needed to use a workaround for a problem that  also encountered. You check for the
                      column in which the image is located by asking if the left border of the image is betwee the column boundaries. Nice try. But
                      what if the image is located just a tiny bit left of the border? Then it is shifted to the previous column.

                      Still worse: if the left border does lie in the space between the columns or to the left of the first one it is not moved at all.

                      This whole problem reflects (IMHO) the difficulties in determining to which column the shape is anchored. Can anybody tell me
                      how to determine the index of the text column I am in?

                      Many VBA functions (at least the examples) refer only to constructs like Object(index),but the online help does not tell me how
                      to find out what "index"  is! Selection.Infrmation helps a little with regard to tables, but how do you find out in which paragraph
                      your selection is?

                      To determine the width of the current text column I tried to use an empty paragraph in that column, right align it and use
                      Selection.Information(wdHorizontalPositionRelativeToTextBoundary). But guess what: this function does not return the value of
                      the current text column, but the value for the first txt column!

                      Example: 3 columns, 4.5 - 6.13 - 2.87 centimeters with a spacing of 1.25 centimeters and a left margin of 2.5 centimeters.
                      Selection.Information(wdHorizontalPositionRelativeToTextBoundary) gives 4.5 centimeters for a paragrph right aligned in the
                      second column!!!

                      The same for Selection.Information(wdHorizontalPositionRelativeToPage). This gives 12.76 cm which is exactly the left margin
                      plus the spacig between the columns plus two times the width of the first column.

                      A bug or a feature???
0
 
tureCommented:
Wolfgang,

Actually, my VBA procedure seems to do a better job than the built-in rightalign feature in in Word 2000.  In Word 2000, I am having problems right-aligning my picture in the last column.

My procedure consistently puts the image right-aligne in the column where the left edge of the picture is. If you prefer right-aligning the image in the column where its right border is, use this slightly modified procedure.

Sub PutImageRightAlignedInColumn()
  Dim img As ShapeRange
  Dim col As TextColumn
  Dim colLeft As Long
  Dim colRight As Long
   
  Set img = Selection.ShapeRange
  img.RelativeHorizontalPosition = wdRelativeHorizontalPositionMargin
 
  For Each col In ActiveDocument.PageSetup.TextColumns
    colRight = colLeft + col.Width
    If img.Left + img.Width >= colLeft And img.Left + img.Width <= colRight Then
      img.Left = colRight - img.Width
      Exit Sub
    End If
    On Error Resume Next
    colLeft = colRight + col.SpaceAfter
    On Error GoTo 0
  Next col
End Sub


I also tried stuff like img.Anchor.Information(wdHorizontalPositionRelativeToPage), with the same disappointing results as you ended up with. I really can't see this as a 'feature'.

/Ture
0
 
shottarumCommented:
Try right clicking on the bitmap image and go to format picture, hit the layout tab and choose either in front of or behind text, change your horizantal alignment to right and then click O.K.

- SHOTTARUM SAYS SO
0
 
calacucciaCommented:
CALACUCCIA SAYS TO SHOTTARUM:

If all you can do is copy comments from others an post them as an answer, you won't get far.

Read what is written above, EVERYTHING, and come to the conclusion you just have added some overflow data to this discussion of no value at all and have pulled out the anger of some people.
0
 
shottarumCommented:
SHOTTARUM SAY TO CALACUCCIA:

You need to answer the question yourself, and stop pulling anger out of your ________, because SHOTTARUM does not welcome your rude comment.  Please give constructive critisicm only.  

SHOTTARUM SAYS TO HUTTER:

I'm sorry that I could'nt help you, however I just misread your question.  Good Luck in finding the correct answer.

0
 
tureCommented:
Upgrading to answer.

I have done a bit of research on this, and it really seems as if there is no easier way to find out the number of the selection's column.
0
 
hutterAuthor Commented:
How do you rate an unsatisfactory answer when the grade of satisfaction does not depend on the answer, but on the limitation Micro$oft imposes on it... Sigh...
0
 
tureCommented:
Wolfgang,

Thanks for the points! I know - it's not easy to know what grade to give for an answer like mine. It's not really the answer you would like to see, but it's the best answer available.

Just to let you know - I have REALLY tried to find a better way.

I have searched the the online help, MSDN and MS KnowledgeBase. I have forwarded this question to Microsoft Word MVP's (a group of people who are very knowledgeable in Microsoft Word and VBA) and Microsoft Support Engineers.

Everywhere, I have found the same answer: There is no simpler way to find the column of a selection. I have received some sample VBA code from the people I discussed this question with, but my own VBA code was really easier than what they sent me.

I certainly hope that Microsoft will add some VBA functionality for this in the next version of Word.

/Ture
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

  • 9
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now