Vba代码给出错误1004

Vba代码给出错误1004

本文介绍了Outlook Vba代码给出错误1004的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Set wks = wkb.Worksheets("Calendar") 'active worksheet
    wks.Cells(NextRow, 1) = ComboBox1.Value

我有这两行代码。当我将分配组合框的值给工作表(wks)的第一个单元格时,它给我一个错误号1004
让我知道一些分辨率....

I have this two lines of code with me. Here it gives me an error number 1004 when I am going to assign the value of combobox to the worksheet's(wks) first cell.Let me know some resolution....

Advance Thanks ....

Advance Thanks....

推荐答案

运行时错误1004通常意味着您指的是您的工作簿中不存在的对象。

Runtime Error 1004 usually means that you are referring to an object that does not exist in your workbook.

与您的情况 wks.Cells(NextRow,1)= ComboBox1.Value
检查变量NextRow的值,并确保其大于0以避免问题。

As in your case wks.Cells(NextRow, 1) = ComboBox1.Valuecheck the value of variable NextRow and make sure its greater than 0 to avoid the issue.

还要检查wks工作簿是否是有效的工作簿对象。

Also check wks workbook is valid workbook object.

这篇关于Outlook Vba代码给出错误1004的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 20:41