Go Premium for a chance to win a PS4. Enter to Win

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

Change the size of a dialog box

I don't know Visual Basic; however, I'm trying to help a user with a Visual Basic macro they have that was written in VB for MS-Word 97.  The macro goes through and counts paragraphs and then displays the first few words of each paragraph in a dialog box.  Then the user can go through and checkmark which paragraphs they want to include in their document.  For those paragraphs that are not checkmarked, the system will automatically delete them from the file.  My problem is that when there are a lot of paragraphs (more than 20), they don't all display in the dialog box.  Is there a way to change the SIZE of the dialog box in VB?  Please be very specific with your instructions, as I do not know VB.  THANKS.

0
esu4236
Asked:
esu4236
  • 5
  • 5
1 Solution
 
gencrossCommented:
What do you mean by dialog box?

Textbox, Richtextbox, listbox, etc...?
0
 
esu4236Author Commented:
Well, part of the macro has this code in it:

RemParasDialog.Show

So that's why I used the term "dialog box".
0
 
gencrossCommented:
It would be helpful to see the code.  Would you be able to post it?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
esu4236Author Commented:
Maybe if you see this code, it will help also:

'This section creates the custom deletion dialog box for the
    'user. It makes a checkbox for each potentially deletable
    'paragraph, but ignores blank lines.
    For MakeBoxes = 1 To DeletableParas
        Selection.Extend Character:=Chr$(13)
        If Selection.Text = Chr$(13) Then
            Selection.ExtendMode = False
            Selection.MoveRight Unit:=wdCharacter, Count:=1
        Else
            With Selection
                .MoveUp Unit:=wdLine, Count:=1
                .MoveDown Unit:=wdLine, Count:=1
                .ExtendMode = True
                Selection.Extend Character:=Chr$(13)
                If Selection.Words.Count >= 5 Then
                    .ExtendMode = False
                    .MoveUp Unit:=wdLine, Count:=1
                    .MoveDown Unit:=wdLine, Count:=1
                    .ExtendMode = True
                    .MoveRight Unit:=wdWord, Count:=5
                End If
            End With
            CheckBoxLabel = Selection.Text & "..."
            Set ParaCheckBox(CheckBoxNo) = RemParasDialog.Controls.Add("Forms.Checkbox.1")
            ParaCheckBox(CheckBoxNo).Left = 12
            ParaCheckBox(CheckBoxNo).Top = (15 * (1 + CheckBoxNo)) - 10
            ParaCheckBox(CheckBoxNo).Width = 300
            ParaCheckBox(CheckBoxNo).Caption = CheckBoxNo & ". " & CheckBoxLabel
            CheckBoxNo = CheckBoxNo + 1
            Selection.Extend Character:=Chr$(13)
            Selection.ExtendMode = False
            Selection.MoveRight Unit:=wdCharacter, Count:=1
        End If
    Next MakeBoxes
   
    'With the custom dialog box built, display it. At this point,
    'program control will be turned over to the dialog box.
    RemParasDialog.Show
    If AbortFlag = True Then
        Exit Sub
    End If
0
 
gencrossCommented:
It looks like the dialog box is a form with checkboxes on it.  You have a couple of options...

Make the form scrollable or put the paragraphs inside a control that scrolls is all I can think of at the moment.

Let me work on it...
0
 
esu4236Author Commented:
Well, I can't seem to delete this question, but I just found a FORM in one of the modules and all I have to do is change the size of the form and it will accommodate all my paragraphs.  THANKS.
0
 
gencrossCommented:
Have you tried to just change the size of the form and see if it works?
0
 
gencrossCommented:
Looks like you did :)
0
 
esu4236Author Commented:
Thanks, gencross, for your assistance.  Yep, I got it figured out.  It works okay now.  Thanks, again.
0
 
schworakCommented:
Really, it sounds like your best bet would be to make the form wide enough to show a reasonable amount of text and replace all that code that creates check boxes with a single list box that has a multi-select and check box capability. This way when there are too many items to fit on the screen the user can scroll down the list checking/unchecking what they like.

I have used this in templates that insert/remove various paragraph that are coming from a database so I would assume the situation you are dealing with would be similar.


Add a listbox named ParaList. The list box needs ListStyle=1 and MultiSelect=1 to reproduce what you are after.


You could then use this code...

ParaList.additem ParaList.ListCount+1 & ". " & Selection.Text & "..."




To replace all this code you now use...

CheckBoxLabel = Selection.Text & "..."
Set ParaCheckBox(CheckBoxNo) = RemParasDialog.Controls.Add("Forms.Checkbox.1")
ParaCheckBox(CheckBoxNo).Left = 12
ParaCheckBox(CheckBoxNo).Top = (15 * (1 + CheckBoxNo)) - 10
ParaCheckBox(CheckBoxNo).Width = 300
ParaCheckBox(CheckBoxNo).Caption = CheckBoxNo & ". " & CheckBoxLabel
CheckBoxNo = CheckBoxNo + 1

0
 
esu4236Author Commented:
Thanks, schworak, I'll give that a try.  Sounds like that might be the ticket.  I did make my dialog box bigger in the form; however, the user has so many variable paragraphs that they are still not going to be able to see all of their options unless they have a 19" monitor.  So your suggestion may work where they can actually scroll in the box to see all of their paragraph choices.

Thanks again!!!

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now