Solved

Change the size of a dialog box

Posted on 2002-07-16
11
169 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
  • 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

810 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