View Single Post
 
Old 09-21-2014, 01:31 AM
Simoninparis Simoninparis is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Feb 2012
Posts: 4
Simoninparis is on a distinguished road
Default VBA Code in a UserForm module to delete a Command Button which opens the userform

Hello all,

I hope the title says (nearly) everything.

In MSWord, I am trying to develop a system in which:

1 User opens a document (document is write protected)
2 User Clicks on a "Start" button on the doc
3 The "Start" button opens a Userform into which users input data in required formats
4 The UserForm puts all the data in the appropriate place on the main document
5 The document is saved as "input1_input2_input3.doc" - inputs from UserForm.

I can get all the above to work. But....

Problem:
Between 4 and 5, or after 5, I would like to get the "Start" command button to be deleted.

I have tried recording a macro and pasting the code into the UserForm module code. No matter whether I use ThisDocument or ActiveDocument, it does not work. It appears that it wants to act on the UserForm.

Do I need (somehow) to set the focus to the main document?
I am sure this can be done but for the moment it is beyond me.

Any help would be most welcome and much appreciated.

Many thanks,
Simon


BTW: Because some of my colleagues use antique PCs, I am obliged to save it as 97/2003 format.
Reply With Quote