+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    01-07-2006
    Posts
    26

    Angry MySpace Status update

    Okay, I've written vba code to log into MySpace, put an updated Status Msg into the status box.....

    but for the life of me, I'm stumped on how to make it click "Update".

    Looking thru the source code I can't find the input tag associated with it.

    Any help would be appreciated....here is what I have now as far as launching the IE, logging in, and then inputting the status msg.

    ** Note, you must initially be logged OUT of MySpace...I'll fix that later.

    Code:
    Sub Myspace()
    
    Dim objIE As Object
    Dim htmlDoc As MSHTML.HTMLDocument
    Dim htmlInput As MSHTML.HTMLInputElement
    Dim htmlImage As MSHTML.HTMLImg
    Dim htmlTable As MSHTML.htmlTable
    Dim htmlColl As MSHTML.IHTMLElementCollection
    Dim Link As MSHTML.HTMLAnchorElement
    Dim iedoc As Object
    Dim streetname As String
    Dim login_URL As String
    Dim counter As Integer
    Dim i As Integer
    Dim resultspage, queryrow As Integer
    Dim name, address, parcelid, nextpageresults As String
    
    
    Set objIE = CreateObject("InternetExplorer.Application")
    
    Sheets("Logins").Select
    mslogin = Range("A1").Value
    msPassword = Range("A2").Value
    login_URL = "http://www.myspace.com/"
    Status = Range("A3").Value
    
    With objIE
        
        ' =========== Here's where I Login in Myspace
        
        .Navigate login_URL
        .Visible = 1 '0 = hidden, 1 = visible
        Do While .Busy: DoEvents:  Loop
        Do While .ReadyState <> 4: DoEvents: Loop
        Set htmlDoc = .Document
        
        ' ========Input Username & Password
        
        Set htmlColl = htmlDoc.getElementsByTagName("INPUT")
        For Each htmlInput In htmlColl
            If htmlInput.name = "ctl00$ctl00$cpMain$cpMain$LoginBox$Email_Textbox" Then
                htmlInput.Value = mslogin
                End If
            
            If htmlInput.name = "ctl00$ctl00$cpMain$cpMain$LoginBox$Password_Textbox" Then
                htmlInput.Value = msPassword
            End If
            
        Next htmlInput
    
    
        ' CLICK THE SUBMIT BUTTON
        
        Set htmlColl = htmlDoc.getElementsByTagName("INPUT")
        
        
        For Each htmlInput In htmlColl
            If htmlInput.name = "dlb" Then
                htmlInput.Click
                Exit For
                End If
        Next htmlInput
        
        Do While .Busy: DoEvents:  Loop
        Do While .ReadyState <> 4: DoEvents: Loop
        
    ' ===== FIND STATUS BOX and enter updated status message
    
        
        Set htmlColl = htmlDoc.getElementsByTagName("textarea")
        For Each htmlInput In htmlColl
            If htmlInput.ID = "smInputBox" Then
                htmlInput.Value = "This is my updated status message"
                End If
    
        Next htmlInput
        
        
        
        ' ========= FIND AND CLICK UPDATE BUTTON ==============
        
        Set htmlColl = htmlDoc.getElementsByTagName("INPUT")   ' ==
        For Each htmlInput In htmlColl                         ' == This section
            If htmlInput.Value = "submit" Then                 ' == is where the
                htmlInput.Click                                ' == problem lies
                Exit For                                       ' ==
                End If                                         ' ==
        Next htmlInput                                         ' ==
       
           
    End With
    
    End Sub
    Any help would be greatly, greatly appreciated!

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & read 2007
    Posts
    15,496

    Re: MySpace Status update

    Hello Steach91,

    What does this post have to do with Excel?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    01-07-2006
    Posts
    26

    Re: MySpace Status update

    What does this post have to do with Excel?
    I have to admit, I'm taken aback by your post.

    I'm using excel to automatically update my MySpace status message on a regular interval. I have a worksheet full of "status messages" which relate to the business and company that I work for (included sales, events etc). Since social networking has become the newest and hottest avenue for revenue generation, I assumed this was appropriate.

    So... any help would be greatly appreciated, considering this is all using Excel.

  4. #4
    Forums Administrator royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    24,447

    Re: MySpace Status update

    If you used Option Explicit & debug the code you will find several errors. Most of your variable declarations are invalid, there is no variable type, etcMSHTML.HTMLDocument in Excel VBA. You do not declare mslogin as a range variable.
    Last edited by royUK; 08-22-2009 at 12:22 PM.
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
    Check out the free Excel Toolbar

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)


    Code Tags: Make your code easier for us to read

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & read 2007
    Posts
    15,496

    Re: MySpace Status update

    Hello Steach91,

    It was an honest question. The code you supplied is generic VBA, not specific to Excel in anyway. Nor was there any mention of transferring data to or from an Excel workbook in your post.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  6. #6
    Registered User
    Join Date
    01-07-2006
    Posts
    26

    Re: MySpace Status update

    Quote Originally Posted by royUK View Post
    If you used Option Explicit & debug the code you will find several errors. Most of your variable declarations are invalid, there is no variable type, etcMSHTML.HTMLDocument in Excel VBA. You do not declare mslogin as a range variable.
    While I appreciate your take, and recognize that I didn't declare all variables, I get zero debugging errors, and the code works perfectly, with the exception of actually clicking the update button. Which is where my question lies.

    It was an honest question. The code you supplied is generic VBA, not specific to Excel in anyway. Nor was there any mention of transferring data to or from an Excel workbook in your post.
    My fault. I assumed that posting in a excel programming forum, it would be understood that my code was excel specific. There are a few lines that reference cell numbers, but I suppose I should have dictated the entire depth of my code in a summary beforehand.....my apologizes.

    But back, to my original question I need a way to click the update button...I can probably copy and paste the myspace source code if that helps but it would be long. It might be easier to just go to a myspace page of your own, and view the source.

  7. #7
    Forums Administrator royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    24,447

    Re: MySpace Status update

    I get debugging errors immediately
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
    Check out the free Excel Toolbar

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)


    Code Tags: Make your code easier for us to read

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & read 2007
    Posts
    15,496

    Re: MySpace Status update

    Hello Roy,

    You need to load the Microsoft HTML Object Library into VBA project.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0