Solved

Change the size of a dialog box

Posted on 2002-07-16
11
173 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
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.

 

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses
Course of the Month7 days, 7 hours left to enroll

632 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