Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello all!
I need to update the VBA code in a tool used by numerous people across the US and found Chip Pearson's code that would seem to solve my problem; the code is he http://www.cpearson.com/excel/vbe.aspx However, when I try to use it I get the following Compile Error: Function call on left-hand side of assignment must return Variant or Object My code looks like this: Sub patch() Dim VBAEditor As VBIDE.VBE Dim ThisVBProj As VBIDE.VBProject Dim ThatVBProj As VBIDE.VBProject Set VBAEditor = Application.VBE Set ThisVBProj = VBAEditor.ActiveVBProject Set ThatVBProj = Application.Workbook("Patch Test.xlsm").VBProject CopyModule("CODE_Clear_Tertial_Data", ThisVBProj, ThatVBProj, False) = True End Sub Any/all help is greatly appreciated! Thanks, Ray |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ray wrote:
CopyModule("CODE_Clear_Tertial_Data", ThisVBProj, ThatVBProj, False)= True CopyModule "CODE_Clear_Tertial_Data", ThisVBProj, ThatVBProj, False eventually if CopyModule("CODE_Clear_Tertial_Data", ThisVBProj, ThatVBProj, False)= True then end if |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
witek,
I appreciate the reply, but the CopyModule coding seems to be right: -- the 'false' at the end is an "over-write existing module' setting -- the 'true' at the end of the line (=true) is the way it needs to be called according to Chip's site If I remove the "= True" part, I get an error of "Expected =" |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ray wrote:
witek, I appreciate the reply, but the CopyModule coding seems to be right: -- the 'false' at the end is an "over-write existing module' setting -- the 'true' at the end of the line (=true) is the way it needs to be called according to Chip's site If I remove the "= True" part, I get an error of "Expected =" remove ( ) |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ok, removed the () ... and now it compiles, BUT throws a new error ...
" Object doesn't support this property or method" on the "Set ThatVBProj" line. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
witek,
I appreciate the reply, but the CopyModule coding seems to be right: -- the 'false' at the end is an "over-write existing module' setting -- the 'true' at the end of the line (=true) is the way it needs to be called according to Chip's site If I remove the "= True" part, I get an error of "Expected =" Chip's example of using CopyModule works exactly as Witek suggests. CopyModule is a function that returns a Boolean (True/False) based on its success/failure. Your code should handle that return something like... If CopyModule Then 'success 'do this Else 'failure 'do that End if -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi Ray,
do you added a reference to the VBA Extensibility library ? isabelle Le 2015-08-28 11:23, Ray a écrit : Ok, removed the () ... and now it compiles, BUT throws a new error ... " Object doesn't support this property or method" on the "Set ThatVBProj" line. |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi Ray,
do you added a reference to the VBA Extensibility library ? isabelle Le 2015-08-28 11:23, Ray a écrit : Ok, removed the () ... and now it compiles, BUT throws a new error ... " Object doesn't support this property or method" on the "Set ThatVBProj" line. Good question! I ass-u-me'd he read Chip's article and thus *followed the instructions within*! -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Le 2015-08-28 18:03, GS a écrit : Good question! I ass-u-me'd he read Chip's article and thus *followed the instructions within*! hi Garry, sometimes, i do zigzag reading, so... isabelle |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Any luck using CopyModule? | Excel Programming | |||
How to fix the coding? | Excel Worksheet Functions | |||
How to fix the coding? | Excel Worksheet Functions | |||
"=ROW()-1" type of coding doesn't appear in a filter / is there coding that does? | Excel Programming | |||
Implant macro coding into ASP coding | Excel Programming |