UserForm cancellation

S

Sandy

Excel 2003
I have a macro which opens another excel file (within same folder)- let's
say NewBook.xls has macro to open OldBook.xls.

OldBook.xls has a UserForm (frmWelcome) which runs but then requires the
user to click a command button on the form to close it. Is there any way
that I can include code (in NewBook.xls) to close the UserForm, or not open
it at all?

Basically I am trying to copy data from OldBook.xls to NewBook.xls, but when
frmWelcome kicks in it jams everything up.

Any ideas?
Sandy
 
B

Bob Phillips

Move the code that triggers the form from the Workbook_Open event to
Auto_open procedure in OldBook.xls. It won't open then.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
S

Sandy

Hi Bob,

Problem is a lot of the workbooks are remote from me. I was hoping to send a
new book out and have the macro run to import all data from the old book.
My fault - did not foresee the userform being a problem!

However - I did include a checkbox on the form that when checked a value is
inserted into a cell and when the Workbook_Open executes next time round it
looks to that cell and if the value is there then the form does not open -
so I suppose I could ask my users to check this box and then save the file
before opening and then running the newbook macro.

Having said that, is it possible to insert the required value into that cell
ie
OldBook.xls!Sheets("SearchData").Range("B2").Value = 1, before opening the
file?

Thanks
Sandy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top