+ Reply to Thread
Results 1 to 4 of 4

Userform closing error

  1. #1
    Registered User
    Join Date
    06-18-2007
    Location
    Preston, Lancs, UK
    Posts
    9

    Userform closing error

    Hi all,

    I’ve an excel user form, within personal.xls, that is used to run several bits of code, basic copy and paste between sheets and workbooks. I’ve added the code to copy a sheet from one workbook to another:

    Windows(TPAForm.txtopenxl.Value).Activate 'Select the xl with the sheet
    Sheets(TPAForm.cbotosheets.Value).Select 'activate the sheet to copy

    Sheets(TPAForm.cbotosheets.Value).Copy Before:=Workbooks(TPAForm.txtcurrxl.Value).Sheets(TPAForm.cbocurrsheets.Value)

    the code works fine but the form closes afterwards, is there a way to keep the form open?

    Ta

  2. #2
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    If you move workbooks the form is not visible because it belongs to the previous workbook, however if you are returning to your original workbook and the form is not visible it is because you have either UNLOADED it or HIDDEN it, like this:

    Please Login or Register  to view this content.
    each line is a single useable command for hiding or unloading the userform, check your code for these, if they are there you can Stet (') them out to see what effect it has on your code.
    Not all forums are the same - seek and you shall find

  3. #3
    Registered User
    Join Date
    06-18-2007
    Location
    Preston, Lancs, UK
    Posts
    9
    Hi Simon, thanks for the response. That’s the bit I can’t figure, I don’t have any hide or unload lines of code, the form simply closes, I thought it might have something to do with it losing focus but I have other bits of code that copy and paste data between open workbooks and the form remains open?

  4. #4
    Registered User
    Join Date
    06-18-2007
    Location
    Preston, Lancs, UK
    Posts
    9
    Closed. I've lost the plot!

+ 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