简体   繁体   English

将单元格复制到新工作表列时出现错误429“Activex组件无法创建对象”

[英]Error 429 “Activex component can't create object” when copying Cells to new worksheet Column

This code copies columns P & Q from each worksheet and posts them to a new worksheet consolidated. 此代码从每个工作表复制列P&Q,并将它们发布到合并的新工作表。 It also deletes all blank cells. 它还删除所有空白单元格。

The code works on a very small file but isn't producing the same results on the new workbook. 代码适用于非常小的文件,但不会在新工作簿上产生相同的结果。

ALL COLUMNS from previous "small workbook" to new workbook are the same. 从以前的“小工作簿”到新工作簿的所有列都是相同的。 The only thing that changed is the number of worksheets which is 650. 唯一改变的是工作表的数量是650。

I get a runtime error 429 "Activex component can't create object". 我得到一个运行时错误429“Activex组件无法创建对象”。

Sub merge()

    Dim Sh As Worksheet, ShM As Worksheet, i&, z&
    Application.ScreenUpdating = 0
    Set Sh = Worksheets.Add(, Sheets(Sheets.Count))
    Sh.Name = "consolidated"
    For Each ShM In ThisWorkbook.Worksheets
        If ShM.Name <> Sh.Name Then
            i = ShM.Cells(Rows.Count, 17).End(xlUp).Row
            z = Sh.Cells(Rows.Count, 2).End(xlUp).Row + 1
            While (z > 1) And (Sh.Cells(z, 2).Value = "")
                z = z - 1
            Wend
            ShM.Activate: ShM.Range(Cells(1, 16), Cells(i, 17)).Copy
            Sh.Activate: Sh.Cells(z, 1).PasteSpecial xlPasteValues
        End If
    Next ShM
    Application.ScreenUpdating = 1
End Sub

This error is not caused by the code you've posted, please see this: You receive run-time error 429 when you automate Office applications 此错误不是由您发布的代码引起的,请参阅: 您在自动化Office应用程序时收到运行时错误429

also this issue has been discussed here: 此问题也在这里讨论过:

Run-time error '429': ActiveX component can't create object VBA 运行时错误'429':ActiveX组件无法创建对象VBA

check tools~>references for the missing components 检查工具〜>缺少组件的参考

I got the same issue 4 years later, my VBA code literally failed on the very first two lines: 4年后我遇到了同样的问题,我的VBA代码在前两行完全失败了:

Dim wb As Workbook
Set wb = ThisWorkbook

Same error if I use ?ThisWorkbook.name in the immediate window, etc. No matter what I do, I cannot use the "ThisWorkbook" object in this particular .xlsm 如果我使用相同的错误?立即窗口中的ThisWorkbook.name等。无论我做什么,我都不能在这个特定的.xlsm中使用“ThisWorkbook”对象

I created a brand new workbook, saved it as .xslm and copied the entire module to the new book, bingo, works perfectly. 我创建了一个全新的工作簿,将其保存为.xslm并将整个模块复制到新书bingo,完美运行。

There doesn't seem to be any difference between the new book I created and the old book that doesn't work... 我创建的新书与不起作用的旧书之间似乎没有任何区别......

tools->references are identical, they were saved on the same machine, same version of excel, etc etc. tools-> references是相同的,它们保存在同一台机器上,同一版本的excel等等。

It's just a bizzare issue that I can't figure out the cause of, in this particular Workbook, the "ThisWorkbook" function is broken. 这只是一个古怪的问题,我无法弄清楚在这个特定的工作簿中,“ThisWorkbook”功能被打破的原因。 Re-creating the workbook from scratch seems to resolve it, but it's a poor solution. 从头开始重新创建工作簿似乎可以解决它,但这是一个糟糕的解决方案。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ActiveX 组件无法创建 object - 429 - ActiveX component can't create object - 429 创建Outlook对象会生成-运行时错误&#39;429&#39;:ActiveX组件无法创建对象 - Creating Outlook object generates - Run-time error '429': ActiveX component can't create object 从 Excel 发送邮件 - 运行时错误“429”:ActiveX 组件无法创建对象 - Sending mails from Excel - Run-time error '429': ActiveX component can't create object 脚本在调试模式下工作,但在正常运行下不工作-错误代码:429(ActiveX组件无法创建对象) - Script working in Debug Mode but not in Normal Run - Error Code: 429(ActiveX Component Can't Create Object') VBA:Acrobat运行时错误429; ActiveX组件无法创建对象 - VBA: Acrobat Run time error 429; ActiveX component can't create object 运行时错误“ 429” activex组件无法创建对象 - run-time error '429' activex component can't create object 使用任务计划程序在 Excel 中运行 selenium v​​ba 宏时,如何修复“运行时错误 429:ActiveX 组件无法创建对象”错误? - How to fix "Run time error 429: ActiveX Component Can't Create Object" Error when using Task Scheduler to run a selenium vba macro in Excel? 使用 Excel VBA 创建 Word 应用程序:运行时错误“429”:ActiveX 组件无法创建对象 - Creating Word Application using Excel VBA: Run-time error '429': ActiveX component can't create object Excel VBA 编写内嵌 VBScript - 运行时错误“429”:ActiveX 组件无法创建对象 - Excel VBA Writing in-line VBScript - Run-time error '429': ActiveX component can't create object 429个ActiveX组件无法从.xlsm文件创建对象导入数据 - 429 activex component can't create object - importing data from .xlsm file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM