Finding last possible variable for Element ID

  • Re: Finding last possible variable for Element ID


    Do you really need to get the 'last possible ID'?


    If you loop through all elements looking for those named like 'detailControlTree_TestControl_rgTest_ctl00__9' ('9' represents any trailing number) then these can easily be written to a worksheet.


    For example


    Running that using
    Getid "http://www.ozgrid.com/forum/forumdisplay.php?f=158", "Thread_"


    to list all the thread titles on the VBA forum main page results in (Element text edited and shortened for clarity):


    [table="class: grid"]

    [tr][td][/td]

    [td="bgcolor:#8E5A2E, align:left"]A[/td][td="bgcolor:#8E5A2E, align:left"]B[/td]

    [/tr][tr]

    [td="bgcolor:#ECF0F0, align:left"]1[/td][th]thread_200746[/th][th] Application Events
    [/th]

    [/tr][tr]

    [td="bgcolor:#ECF0F0, align:left"]2[/td][th]thread_200743[/th][th]Copy & Paste According to Reference
    [/th]

    [/tr][tr]

    [td="bgcolor:#ECF0F0, align:left"]3[/td][th]thread_200719[/th][th]list all possible combinations[/th]

    [/tr][tr]

    [td="bgcolor:#ECF0F0, align:left"]4[/td][th]thread_200739[/th][th]Runtime-Error 9, when other user has source sheet open
    [/th]

    [/tr][tr]

    [td="bgcolor:#ECF0F0, align:left"]5[/td][th]thread_200732[/th][th]Use a For loop and Find function to filter
    [/th]

    [/tr][tr]

    [td="bgcolor:#ECF0F0, align:left"]6[/td][th]thread_200741[/th][th]Finding last possible variable for Element ID
    [/th]

    [/tr][tr]

    [td="bgcolor:#ECF0F0, align:left"]7[/td][th]thread_200740[/th][th]Filling with Today's Date if Blank
    [/th]

    [/tr][tr]

    [td="bgcolor:#ECF0F0, align:left"]8[/td][th]thread_200730[/th][th]Automatically move to next sheet and perform Macro
    [/th]

    [/tr][tr]

    [td="bgcolor:#ECF0F0, align:left"]9[/td][th]thread_200737[/th][th]Update Master workbook automatically
    [/th]

    [/tr][tr]

    [td="bgcolor:#ECF0F0, align:left"]10[/td][th]thread_200684[/th][th]Upgrade existing macro to send data from multiple rows in one email
    [/th]

    [/tr][tr]

    [td="bgcolor:#ECF0F0, align:left"]11[/td][th]thread_200733[/th][th]Perform If... Then Statements and Arithmetic or Concatenation on Ranges
    [/th]

    [/tr][tr]

    [td="bgcolor:#ECF0F0, align:left"]12[/td][th]thread_200726[/th][th]Conditional Formatting with If Statements
    [/th]

    [/tr][tr]

    [td="bgcolor:#ECF0F0, align:left"]13[/td][th]thread_200729[/th][th]run macro after data validation
    [/th]

    [/tr][tr]

    [td="bgcolor:#ECF0F0, align:left"]14[/td][th]thread_200705[/th][th]Send Excel Document Using Lotus Notes
    [/th]

    [/tr][tr]

    [td="bgcolor:#ECF0F0, align:left"]15[/td][th]thread_200714[/th][th]Vbs copy cells into named range table
    [/th]

    [/tr][tr]

    [td="bgcolor:#ECF0F0, align:left"]16[/td][th]thread_200723[/th][th]combine multiple same name sheets into separate sheets
    [/th]

    [/tr][tr]

    [td="bgcolor:#ECF0F0, align:left"]17[/td][th]thread_200654[/th][th]Excel 2007 - 2010 VBA to interact / automate a commercial compiled database
    [/th]

    [/tr][tr]

    [td="bgcolor:#ECF0F0, align:left"]18[/td][th]thread_200728[/th][th]Command Button Combine Selected File Paths In ListBox To New Workbook Same Sheet
    [/th]

    [/tr][tr]

    [td="bgcolor:#ECF0F0, align:left"]19[/td][th]thread_200702[/th][th]Checking if sheet exists
    [/th]

    [/tr][tr]

    [td="bgcolor:#ECF0F0, align:left"]20[/td][th]thread_200708[/th][th]Insert number of rows based on cell value
    [/th]

    [/tr]

    [/table]


    The code is rough, could be improved and optimised, but illustrates the idea.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!