Solved

Change the size of a dialog box

Posted on 2002-07-16
11
171 Views
Last Modified: 2010-05-02
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
Comment
Question by:esu4236
[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
  • 5
  • 5
11 Comments
 
LVL 4

Expert Comment

by:gencross
ID: 7157885
What do you mean by dialog box?

Textbox, Richtextbox, listbox, etc...?
0
 

Author Comment

by:esu4236
ID: 7157918
Well, part of the macro has this code in it:

RemParasDialog.Show

So that's why I used the term "dialog box".
0
 
LVL 4

Expert Comment

by:gencross
ID: 7157920
It would be helpful to see the code.  Would you be able to post it?
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:esu4236
ID: 7157941
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
 
LVL 4

Expert Comment

by:gencross
ID: 7157958
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
 

Author Comment

by:esu4236
ID: 7157961
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
 
LVL 4

Expert Comment

by:gencross
ID: 7157967
Have you tried to just change the size of the form and see if it works?
0
 
LVL 4

Expert Comment

by:gencross
ID: 7157971
Looks like you did :)
0
 

Author Comment

by:esu4236
ID: 7158017
Thanks, gencross, for your assistance.  Yep, I got it figured out.  It works okay now.  Thanks, again.
0
 
LVL 3

Accepted Solution

by:
schworak earned 200 total points
ID: 7158253
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
 

Author Comment

by:esu4236
ID: 7159388
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

Independent Software Vendors: 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!

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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.
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…

710 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