+ Reply to Thread
Results 1 to 6 of 6

Copying a userform from one project to another

  1. #1
    Registered User
    Join Date
    01-17-2011
    Location
    calgary, alberta
    MS-Off Ver
    Excel 2003
    Posts
    61

    Copying a userform from one project to another

    Hi,

    I have recorded a macro and assigned it to a pushbutton. When the button is selected, the macro that will run will copy the current workbook and open a new blank workbook and past the sheets into the new workbook. The only problem with this is, it doesn't copyt the user form that I have created.

    Does anyone know how to have the userform copied from one workbook to another using macro code?

    Thanks in advance.

  2. #2
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: Copying a userform from one project to another

    Hi,

    It sounds like you're copying everything over? You could simply use the Workbook.SaveCopyAs method instead?
    Hope that helps,

    Colin

    RAD Excel Blog

  3. #3
    Registered User
    Join Date
    01-17-2011
    Location
    calgary, alberta
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: Copying a userform from one project to another

    I don't think that will apply in my case, because the user would be saving the workbook already prior to running this copy macro. It works like this.

    The user will use the workbook one day, and at the end of the day they will save their workbook. The next day, they will open yesterdays' workbook, and simply hit the macro to copy everthing and create a new workbook for the next day. but in doing this, they will lose the userform that they need to fill out as part of the work book.

    thnaks.

  4. #4
    Registered User
    Join Date
    01-17-2011
    Location
    calgary, alberta
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: Copying a userform from one project to another

    its interesting to me because in my macro to copy everything over, I only tell it to copy the worksheets, but it also automatically copies the modules; which is good, but it also needs to copy the userforms.

  5. #5
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: Copying a userform from one project to another

    Quote Originally Posted by calmena View Post
    I don't think that will apply in my case, because the user would be saving the workbook already prior to running this copy macro. It works like this.

    The user will use the workbook one day, and at the end of the day they will save their workbook. The next day, they will open yesterdays' workbook, and simply hit the macro to copy everthing and create a new workbook for the next day. but in doing this, they will lose the userform that they need to fill out as part of the work book.

    thnaks.
    Workbook.SaveAs or Workbook.SaveCopyAs both sound perfect for this then.

    If you use Workbook.SaveAs, the user just clicks the button and yesterday's workbook will be saved as today's workbook, and then they are ready to rock and roll?

    Both of these methods will keep the userform.

  6. #6
    Registered User
    Join Date
    01-17-2011
    Location
    calgary, alberta
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: Copying a userform from one project to another

    Ok, I will give it a try. Can you tell me how to use "workbook.saveas"?

    Do I insert it in VBA somewhere or do I insert it in the macro module somewhere?

    Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1