View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming, microsoft.public.word.vba.general,microsoft.public.word.vba.userforms
JRF JRF is offline
external usenet poster
 
Posts: 5
Default Automated Forms issue

On Dec 31, 7:13*pm, Ken McLennan wrote:
G'day there One & All,

* * * * Please forgive my indiscretion if I've contravened polite usage
of crossposting. I've not needed to send to more than one group before
so I'm unsure of the protocols or accepted practices.

* * * * I'm currently working on an automation project in which I have a
report in Word that refers to data in various Excel worksheets which are
of different layouts. The layouts are preset (by higher powers than my
humble position) in the database report builder and I have no ability to
influence the layouts or formats. To select which cells are referred to
for data I have a form in my Word document which is used to select &
open the appropriate Excel document - fortunately there is only a single
worksheet in each workbook - and then allow my users to simply click on
a cell to select the appropriate heading or list.

* * * * I don't want to hijack my user's systems and prevent them from
opening or using other applications (although a few of them are absolute
gumbys and that wouldn't be a bad idea) but I want to keep my automation
windows layered so that I have the Word document on the bottom, Excel
window next, then my userform. I don't care if anyone wants to check
their email while it's open, but when they come back to work on it I
want it to have my windows in that order.

* * * * At the moment, the form appears; I select & open the desired
workbook; I click the control to select the worksheet cell and when I
click the worksheet cell the Excel application is brought to the front
of the screen - which is exactly what I expected, but I want my modeless
form to remain on top as I switch Office applications.

* * * * Is it possible in some way to switch the parent of the form in
mid run? I've not found such a procedure and doubt it's possible but
more knowledgeable minds may be able to think of somehow to do it.

* * * * I don't know if it's possible to do any the above, but the only
alternative I can think of is to write code in Word to insert code in
Excel and its VBE that builds a userform with its code to run in the XL
app. Something I may spend weeks writing only to find it doesn't work
anyway.

Thanks for listening,

Ken McLennan
Qld, Australia


It sounds like you have a fun project to work on. I'm not sure my
suggestions will help but I think I've had to do something similar in
the past. The way I would do this is to not display the word document
until the users were done selecting whatever value(s) they needed in
Excel. I would then instantiate an instance of word within Excel VBA,
use bookmarks to insert the values that were selected in excel, then
finally open the word document for display. I've not ever tried
anything like this while the word document was visible.

I know this is not exactly what you want to do but perhaps by reducing
the scope a bit you can get it done and move on rather than fight it
for the rest of your career.

Good Luck!