View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Andreas Maistmann Andreas Maistmann is offline
external usenet poster
 
Posts: 3
Default Problem with Dialogs(xlDialogWorkbookNew)

Hello,
I experience a strange behaviour, which I can't explain myself.

I would like to put a button on a Toolbar which opens the "new
workbook from template" Dialog. This is the Dialog which opens when
you select "General templates..." on the task pane. On the Net I
found the following code snippet for this:

dlgAnswer = Application.Dialogs(xlDialogWorkbookNew).Show

I created a procedure and linked it to a button on the toolbar. At
first sight this seemed to work fine, if you press the button, the
required dialog opens.

The first problem I encountered was, that the dialog only opens when
another workbook is already open, otherwise I got an error message.
This is not such a big problem, since you can work around this by open
some standard workbook, before invoking the mentioned dialog.

But the second problem I encountered gives me real headaches: When I
open a template in the dialog Excel didn't create a new workbook
based on that template, as I would have expected, but inserts the
selected template into the already open workbook. This means, if I had
a workbook with sheet1 and sheet2 open and invoked the dialog and
select a template with sheetx and sheety in it, I end up with a
woorkbook with four sheets (sheet1, sheet2, sheetx and sheety). Also
the color palette is the one of the workbook that was open at the
beginning.

I hope I could make the problem clear, if not, please ask and I will
try to clarify things.

I was able to reproduce this behaviour on office 2000, XP and 2003 (all
German version on WinXP).

What I would like to know is, can anybody else confirm this problem. Is
this a known bug, or am I doing something wrong? If somebody knows a
solution or a clever workaround, it will be of course much appreciated.

Thanks in advance for any help,
Andreas