+ Reply to Thread
Results 1 to 3 of 3

Proplem copying a Module - Error 50289

  1. #1
    Trefor
    Guest

    Proplem copying a Module - Error 50289


    I found the following code (sorry can't remember where now), it work great
    with one catch, if ThisWorkbook is password protected the routine fails.

    Dim myFile As String
    myFile = "CCRFMacro.bas"
    ThisWorkbook.VBProject.VBComponents("CCRFMacro").Export (myFile)
    ActiveWorkbook.VBProject.VBComponents.Import (myFile)
    Kill myFile

    The error is "Can't perform operation since the project is projected."

    I do not want to unprotect the project, so is there another option to copy a
    mudule from ThisWorkbook to ActiveWorkbook?

    --
    Trefor

  2. #2
    Forum Contributor
    Join Date
    01-10-2006
    Location
    Ahmedabad, India
    MS-Off Ver
    Office 2000
    Posts
    346
    Quote Originally Posted by Trefor
    I found the following code (sorry can't remember where now), it work great
    with one catch, if ThisWorkbook is password protected the routine fails.

    Dim myFile As String
    myFile = "CCRFMacro.bas"
    ThisWorkbook.VBProject.VBComponents("CCRFMacro").Export (myFile)
    ActiveWorkbook.VBProject.VBComponents.Import (myFile)
    Kill myFile

    The error is "Can't perform operation since the project is projected."

    I do not want to unprotect the project, so is there another option to copy a
    mudule from ThisWorkbook to ActiveWorkbook?

    --
    Trefor
    In my opinion you can't do it. Apparently code of ThisWorkbook is protected. You then cannot read it without unprotecting it. If your concern is not to leave it unprotected then you could unprotect it in your procedure and immediately protect it again after you copied it to activesheet module.

  3. #3
    Trefor
    Guest

    Re: Proplem copying a Module - Error 50289

    avveerkar,

    Thankyou for the feedback. Ok so the next queston is how to you unprotect a
    project from within the protected project?

    --
    Trefor


    "avveerkar" wrote:

    >
    > Trefor Wrote:
    > > I found the following code (sorry can't remember where now), it work
    > > great
    > > with one catch, if ThisWorkbook is password protected the routine
    > > fails.
    > >
    > > Dim myFile As String
    > > myFile = "CCRFMacro.bas"
    > > ThisWorkbook.VBProject.VBComponents("CCRFMacro").Export (myFile)
    > > ActiveWorkbook.VBProject.VBComponents.Import (myFile)
    > > Kill myFile
    > >
    > > The error is "Can't perform operation since the project is projected."
    > >
    > > I do not want to unprotect the project, so is there another option to
    > > copy a
    > > mudule from ThisWorkbook to ActiveWorkbook?
    > >
    > > --
    > > Trefor

    >
    > In my opinion you can't do it. Apparently code of ThisWorkbook is
    > protected. You then cannot read it without unprotecting it. If your
    > concern is not to leave it unprotected then you could unprotect it in
    > your procedure and immediately protect it again after you copied it to
    > activesheet module.
    >
    >
    > --
    > avveerkar
    > ------------------------------------------------------------------------
    > avveerkar's Profile: http://www.excelforum.com/member.php...o&userid=30338
    > View this thread: http://www.excelforum.com/showthread...hreadid=503328
    >
    >


+ 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