Code from VBA is working, but from VS2013 no
This my working piece of code in VBA
Code:
Dim objExcel As Object
Dim objCell As Object
Dim objWorksheet As Object
Set objExcel = Excel.Application ' GetObject(, "Excel.Application")
Set objWorksheet = objExcel.ActiveWindow.ActiveSheet
Set objCell = objExcel.ActiveCell
If objExcel.CountA(objWorksheet.Rows(1).EntireRow) <> 0 Then
objExcel.ActiveWindow.SmallScroll Down:=1
End If
All works fine. But in vs2013 error occurred
System.Runtime.InteropServices.COMException was unhandled
my code is:
Code:
Dim objExcel As Object
Dim objCell As Object
Dim objWorksheet As Object
objExcel = GetObject(, "Excel.Application")
objWorksheet = objExcel.ActiveWindow.ActiveSheet
objCell = objExcel.ActiveCell
If objExcel.CountA(objCell.Rows.EntireRow) <> 0 Then '<========= ERROR LINE
objExcel.ActiveWindow.SmallScroll(Down:=1)
End If
Re: Code from VBA is working, but from VS2013 no
.EntireRow is not supporting. :(
Can solve by replacing this code:
If objExcel.CountA(objCell.Rows.EntireRow) <> 0 Then
to
If objExcel.CountA(objWorksheet.Rows(objCell.Row)) <> 0 Then