Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default 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").E xport (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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Proplem copying a Module - Error 50289


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").E xport (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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default 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").E xport (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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding cells proplem r New Users to Excel 2 April 5th 06 04:14 AM
Adding 2 cells proplem r Excel Discussion (Misc queries) 0 April 4th 06 07:40 PM
Adding 2 cells proplem Elkar Excel Discussion (Misc queries) 0 April 4th 06 07:36 PM
How do I get rid of "Compile error in hidden module" error message David Excel Discussion (Misc queries) 4 January 21st 05 11:39 PM
Compile error in hidden module error Melissa Zebrowski Excel Programming 3 February 20th 04 01:29 PM


All times are GMT +1. The time now is 06:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"