Solved

Stacking Labels in Vb

Posted on 2006-06-15
5
214 Views
Last Modified: 2010-04-07
Q.  I use Vb to stack long label names in GIS and now need to add more that one field.  Here is the current code:

' Function FindLabel ( [NAME] )
' Stacks a label in multiple lines if
' exceeding a given length.
' Note: Not applicable to line layers.
' ------------------------------------
  dim s, sNew, i, l
  s = [NAME]
  l = Len(s)
  if l > 10 then  ' stack if exceeding this length
    sNew = Left(s,10)
    i = 11  ' scan for blank space starting from this position
    While i <= l
      if Mid(s,i,1) = " " then
        sNew = sNew & VBNewLine
      else
        sNew = sNew & Mid(s,i,1)
      end if
      i = i + 1
    Wend
  else
    sNew = s
  end if

I need to add a field called SITEADDR and limit it's character line the same as NAME.  Any ideas?
0
Comment
Question by:gwr477
  • 2
5 Comments
 
LVL 13

Accepted Solution

by:
Mark_FreeSoftware earned 500 total points
ID: 16912816

ok, i don't quiet understand the question, but what you want to do can be done way easier:

give the label the width you want to have it max.

now set the property wordwrap of the label to true,
and the property autosize too

so the code looks somthing like this:

Label1.Width = 1575
Label1.WordWrap = True
Label1.AutoSize


you can also do this when designing

0
 
LVL 4

Expert Comment

by:JRCSystems
ID: 17287217
Is this question still open?
I agree with Mark, not quite sure what you're trying to do.
Can you give us some more info please?
0
 

Author Comment

by:gwr477
ID: 17287336
Sorry for not closing this earlier.  Thanks for your expert help.
0
 
LVL 13

Expert Comment

by:Mark_FreeSoftware
ID: 17287720

thanks for the points, and happy coding!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
passing a value with stream reader AFTER a ";" 3 58
Access Object Property from VBA Module in Excel 2010 2 27
How to Add / Edit Windows Menu 4 51
MsgBox 4 46
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now