View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ray Ray is offline
external usenet poster
 
Posts: 267
Default Help with CopyModule coding

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