I have this code
$file = FileOpen(@ScriptDir & "\test.txt", 1)
$oExcel = _ExcelBookOpen(@ScriptDir & "\Master List.xls",0)
$oExcel.sheets("Non-Compliant").Select
Do
$oExcel.cells.Find($NewArray[$1]).select
$oExcel.ActiveCell.entirerow.copy
FileWriteLine($file,Clipget())
$1 += 1
Until $1 = UBound($NewArray)
_ExcelBookClose($oExcel)
Everything works however if the array variable is not found it copies the previous selection into the "test.txt file
Is there a way to deselect or an if statement to use in conjunction with the vba code?
I tried
$file = FileOpen(@ScriptDir & "\test.txt", 1)
$oExcel = _ExcelBookOpen(@ScriptDir & "\Master List.xls",0)
$oExcel.sheets("Non-Compliant").Select
Do
if $oExcel.cells.Find($NewArray[$1]).select = 0 Then
$oExcel.ActiveCell.entirerow.copy
FileWriteLine($file,Clipget())
endif
$1 += 1
Until $1 = UBound($NewArray)
_ExcelBookClose($oExcel)
which did not work
I think I got something that will work but don't know how to pass a macro to excel from autoit
***********
EXCEL MACRO
***********
Sub UnSelectCurrentArea()
Dim Area As Range
Dim RR As Range
For Each Area In Selection.Areas
If Application.Intersect(Area, ActiveCell) Is Nothing Then
If RR Is Nothing Then
Set RR = Area
Else
Set RR = Application.Union(RR, Area)
End If
End If
Next Area
If Not RR Is Nothing Then
RR.Select
End If
End Sub



Help
Back to top









