SkysLastChance

_Excel_RangeWrite - How Do I go to next row before looping

5 posts in this topic

I am trying to pull data from a website and input into excel for a set number of times. This is the code I have so far. How should I go about going down 1 row at a time? If there is a certain help file I should be looking at let me know.

#include <IE.au3>
#include <Excel.au3>



Excel ()
$sBox = InputBox ("Chart", "How Many Times")


Func Excel ()

While ProcessExists("EXCEL.EXE")
$ms = MsgBox(5,"","Process error.  You have an Excel sheet open.  You must close it in order to let this program work.  Please close it now.")
    If $ms=2 Then Exit
Sleep(250)
WEnd
   Global $sExcelFile = FileOpenDialog("Choose/Create Excel File", @ScriptDir, "(*.xlsx)")

If FileExists($sExcelFile) Then
   Global $oExcel = _Excel_Open ()
    $oExcel = _Excel_BookOpen($oExcel,$sExcelFile) ;this will open the chosen xls file.

EndIf
EndFunc



Local $i = 0

Do
$oIE = _IE_Example("basic")
$oDiv = _IEGetObjById($oIE, "line1")
_Excel_RangeWrite($oExcel,Default, $oDiv.innertext, "A1")
$oDiv = _IEGetObjById($oIE, "line2")
_Excel_RangeWrite($oExcel,Default, $oDiv.innertext, "B1")
$oDiv = _IEGetObjById($oIE, "line3")
_Excel_RangeWrite($oExcel,Default, $oDiv.innertext, "C1")

$i = $i + 1

Until $i = $sBox

 

 

 

 

 

 

 

 

 

 

 

 

 


Life's simple. You make choices and you don't look back.

Share this post


Link to post
Share on other sites



Try:

Local $i = 1
Do
    $oIE = _IE_Example("basic")
    $oDiv = _IEGetObjById($oIE, "line1")
    _Excel_RangeWrite($oExcel,Default, $oDiv.innertext, "A" & $i)
    $oDiv = _IEGetObjById($oIE, "line2")
    _Excel_RangeWrite($oExcel,Default, $oDiv.innertext, "B" & $i)
    $oDiv = _IEGetObjById($oIE, "line3")
    _Excel_RangeWrite($oExcel,Default, $oDiv.innertext, "C" & $i)
    $i = $i + 1
Until $i > $sBox

 

1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I can't thank you enough.

1 person likes this

Life's simple. You make choices and you don't look back.

Share this post


Link to post
Share on other sites

:)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

NVM

Edited by SkysLastChance

Life's simple. You make choices and you don't look back.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now