Cách dùng hàm writeCell trong RCA.Excel.workbookApplication

Em có sử dụng Excel application scope tạo biến wb(kiểu RCA.Excel.workbookApplication)
sau đó có invoke vba

wb.WriteCell("A1", "toannv")

Chạy thử thấy báo lỗi:

Message: Object reference not set to an instance of an object.
Stack trace: 
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at RCA.Activities.Core.CompilerRunner.Run(Object[] args)
   at RCA.Activities.Core.InvokeCode.Execute(CodeActivityContext context)
   at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
   at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Thi không biết cách dùng hàm này thế nào?

@ductm1 @Le_Linh nhờ 2 anh hỗ trợ anh ToanNV nhé.

với App là output của Excel application scope

app.SetSheet(“Sheet1”, false)
app.WriteCell(“A1”, “Toannv”)
app.CurrentWorkbook.Save()

@HaiPT nhờ anh support giúp em ạ

@AnhDT24 Topic này xong rồi em .
@toannv đã được @ductm1 support và post lời giải lên đây rôì!

Thank anh Hải nhiều ạ

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.