PDA

View Full Version : Macro/VBA Help



Gidday
05-19-2010, 09:33 PM
Hi Folks

I have a select list in my word docm. When I select Invoice I would like the bank details to display on the page ready for printing, but when I select quote the details do not show nor do they print.

Can someone give me a start or point me in a direction.

Thanks

Joe

TonyJollans
05-20-2010, 12:20 AM
There is nothing meaningful I can say in reply to that. You're going to have to provide quite a bit more information in order to get any help.

Gidday
05-20-2010, 03:55 AM
Hi TonyJollans

Fair enough.

I have a Word 2007 Macro Document that has a control: drop-down list where I can choose either quote or invoice.
I have my banking details located at the bottom of the form.
I would like it that when I choose Invoice that the banking details are visible for printing, pdfing, etc. When I choose quote I do not want the bank details visible.

Thanks for looking.

Joe

TonyJollans
05-20-2010, 05:55 AM
I think I would probably have the bank details inside an IF Field, and set appropriate values when the dropdown changed, but you could - more simply, perhaps - just add the bank details to the document when needed. All assuming your dropdown is ActiveX and you have code running when it is changed.

fumei
05-20-2010, 08:44 AM
I agree. More specific details are needed in order to give more specific suggestions.

Are you doing this once? More than once?

If once, then I would build the contents. From AutoText, or from a separate file.

If more than once (i.e. the banking details freely become visisble, or not), that is a different concept. Yes, then you need to control content visibility - although you could (and I would) probably build/rebuild depending on the value of the dropdown.

Gidday
05-20-2010, 06:28 PM
Tony/Gerry

Thanks for taking the time with this. I probably should point out that my programming experience is limited to web pages and vbscript so I am hoping I can get my head around this. I am happy building simple Word form docs but this is a bit beyond that.

The page will be used on multiple occassions.

I was thinking that if there was a way to link the display of the bank details to an IF statement fired by the selection in the drop-down list then that would do. I didn't understand this bit "build/rebuild" so I don't know how to answer that.

This is where I'm struggling.

Thanks

Joe

fumei
05-21-2010, 09:37 AM
If "Invoice" selected, build the document elements appropriate (include or not include whatever) for that, using AutoText (or pulling from another library type document).

If "Quote" selected, build the document elements appropriate (include or not include whatever) for that, using AutoText (or pulling from another library type document).

In other words, essentially the document start off blank - unless you have elements that are always to be there.

If you select Invoice, the elements appropriate for that are inserted. If you select Quote, ditto.

The issue seems to be you want parts to NOT be there under one circumstance. Yes, you try using Hidden font, but I am not a real fan. It depends. If you really wish something to not be there, IMO, then it should simply NOT be there at all...not Hidden. It is too easy to make Hidden visible.

So basically, the concept is:

if X selected, go get the contents for X and insert them into the document.

if Y selected, go get the contents for Y and insert them into the document.