• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 798
  • Last Modified:

Multi Layer DropDown Boxes Word 2010

Hi Experts,

I use Word sparingly so have no idea on VB code etc so you'll have to be gentle with me if the following is simple (or walk me through very carefully if its difficult!)

I'm working on a word document that will provide a proposal to clients. One of the sections has to do with their SLA. I'd like to have a dropdown that allows me to choose the SLA level (Bronze,silver, gold , platinum) which is fairly easy BUT

Based upon that selection I then want to be able to add lines to a table (sometimes only two or 3 lines, sometimes more like 10 or 12 - each will be different so I need the table to grow as required but ideally not have to then remove blank lines) but the possible additions will be determined by the SLA chosen.

I then want to automatically add a price on the end based on the previous two so it would look something like:

Gold               Wigdet Support                         $200
Silver              Sprocket Support                      $150

etc etc

I may be trying to be too clever (maybe I just have to have one SLA that then sets up the table so if I choose gold at the top then all support is gold and priced as such?)

No coding skills at all but willing to try so any pointers happily taken

Thanks

Andy
0
Randy_Bojangles
Asked:
Randy_Bojangles
  • 3
  • 3
1 Solution
 
GrahamSkanRetiredCommented:
Not sure what sort of dropdown you are using, but it all sounds quite possible.

Here is some code to add and fill a couple of rows to the first table in the current document.
Sub AddRows()
    Dim tbl As Table
    Dim i As Integer
    Dim rw As Row
    
    Set tbl = ActiveDocument.Tables(1)
    Set rw = tbl.Rows.Add
    rw.Cells(1).Range.Text = "Gold"
    rw.Cells(2).Range.Text = "Wigdet Support"
    rw.Cells(3).Range.Text = "$200"
    Set rw = tbl.Rows.Add
    rw.Cells(1).Range.Text = "Silver"
    rw.Cells(2).Range.Text = "Sprocket Support"
    rw.Cells(3).Range.Text = "$150"
End Sub

Open in new window

0
 
Randy_BojanglesAuthor Commented:
so I think I see what this does in terms of drawing the the table - thanks

However when I run it it says Cant execute in break mode?

Also this seems to be that I have to define the objects in the macro (Gold, Widget Support etc)

What I want is to be able to pick each of those things from a dropdown as it will be different each time (I think I'm explaining this poorly)

So next customer may not have widget support and may have bronze on sprockets etc and I want to be able to build it up for each customer s I go

If this is way too much work then I'll have to do it by hand I guess

Thanks for your help so far though!
0
 
GrahamSkanRetiredCommented:
There can be only one set of VBA code running per instance of an application. If some code has entered break mode for any reason e.g. error, user pressed Ctrl+break, code hit a breakpoint etc, another (or even the same) set of VBA code cannot be started. That is what the message means. In the VBA window, you should see the word in the title caption, and some code highlighted in yellow.

Whatever the programming environment, we have to be clear about our requirements and datasources.

Also, it is not clear about where the dropdown is. If you have a complex selection process that does not need to appear on the document, then, I suggest, it would be best to use VBA UserForms to gather the data and to, if necessary, present further means of selecting details, depending on earlier selections.

0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
Randy_BojanglesAuthor Commented:
I can have all of the possible options (they are finite, though complex) held elsewhere - they're currently in an Excel sheet

I have no idea what a VBA userForm is though!
0
 
GrahamSkanRetiredCommented:
Most VBA-enabled applications - Access is a notable exception - can create a form that is not part of the document. By document I mean the presentation object that the application is intended for - in Word it is formally a Document, but it could be a Spreadsheet (Excel), a Message (Outlook) or a Slide (Powerpoint).

In Word, VBA (and its UserForms) are aids to producing a final document, ready for printing.

To complete your task, I think that you would need to learn at least an overview of VBA and to post extra questions if and when you get stuck again. However, your question is beginning to look rather larger than what is generally thought of as a single question. In fact it's beginning to resemble a project.

An alternative would be to turn it over to a professional VBA programmer, such as you might find via something like Rent-a-coder. But also note that some of the experts here will take on paid projects. If so, the fact and contact information will be in their profile.
0
 
Randy_BojanglesAuthor Commented:
Ok then, thanks

If you could point me in the direction of some good starting documentation/web articles etc then that would be appreciated
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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