Posts by Richie(UK)

    Re: Excel VBA SUMPRODUCT QUOTATION MARKS


    Hi,


    I think the problem is probably caused by the mixed references that you are using - part R1C1 and past A1. If you can re-write the initial part of the code to use A1 also then I suspect that the problem will go away.

    Re: Execute code before workbook deactivate


    Hi,


    I've only looked at this quickly but could you change the event code to add in a workbook test, like this?


    Code
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Me.Parent.Name = ActiveWorkbook.Name Then
            MsgBox "changed"
        End If
    End Sub

    Re: Using sendkeys and loop to download files


    Hi,


    I've deleted the data that looked like it was personal/private (you may wish to consider changing your password, just in case).


    As for the code, how about changing the Set line to :

    Code
    Set inputCollection = ieDoc.forms(0).getElementByID("download")


    I think I picked up the wrong value before, so try:

    Code
    Set inputCollection = ieDoc.forms(0).getElementByID("download")
         
        For Each inputElement In inputCollection
            If inputElement.getAttribute("value") = "Download" Then
                inputElement.Click
                Exit For
            End If
        Next inputElement

    Re: loop my range with criteria


    Hi,


    Is this what you had in mind?


    Re: Using sendkeys and loop to download files


    Hi again,


    It's weird coming up with code and not being able to test it! Do me a favour? When we are finished post the final routine (less any confidential stuff of course) just for reference in case anybody else has similar issues and uses the Search)


    Anyway, how about adding:


    Code
    Set inputCollection = ieDoc.getElementsByTagName("download")
     
        For Each inputElement In inputCollection
            If inputElement.getAttribute("value") = "no--DrgyX79ihQVaG-0SqtOquypjt4NxHUl8zoS6wrfoZzO8z73vF5DIKlxhD-rO" Then
                inputElement.Click
                Exit For
            End If
        Next inputElement

    Re: VB Code applied to entire column


    Is this the sort of thing that you are looking for?


    Re: Using Range() Property With Do While Loop


    Hi,


    You could try buying a book like "Excel 2007 VBA Programmer's Reference". If that isn't an option then just keep writing code, use F1 to use the in-built help, and frequent forums such as this one (you don't have to post solutions if you don't want to but think about how you would tackle a problem and then compare that with what others suggest). Oh, and don't forget to make use of the macro recorder - you will often need to tidy up its efforts but it will point you in the right direction. Keep at it :)

    Re: Printing Setup Macro!


    Hi Blake,


    As suggested, the macro recorder is often a good starting place for generating code in situations like this. You can then look to modify it and might go with something like this:



    You could add the code to each of the financial models or add it to your Personal.xls to have it available for use on all workbooks (you can assign a keyboard shortcut to it to make its use easier).

    Re: vba code / stock historical price macro ?


    Hi,


    Take a look at using QueryTables. You can probably get pretty much all you need by recording a macro of you doing this manually - that's how I started with the following:


    Re: vba code / stock historical price macro ?


    Hi and welcome to the forum.


    As this is a school project I take it that you have been given some guidance on how to proceed. What were you told? What initial ideas do you have (other than ask on a forum to get somebody else to do the project for you! ;) )


    Might also be useful if you indicate which exchange these stocks are quoted on.

    Re: Using sendkeys and loop to download files


    Hi,


    Would you:
    1. Post the routine that you are currently using (replace your company details with alternatives for illustration but keep the code the same).
    2. Confirm that you have set the required references.

    Re: Using sendkeys and loop to download files


    Hi,


    That is good news - should make things much easier for you.


    The following should help to get you started. I've used http://www.fool.co.uk/index.aspx as an example site. If you register there (it's free and just for the purposes of illustration). The following code will login, using the details provided, and navigate to a given page.



    It's a bit of a mish-mash of exisiting routines that I have just to serve as an illustration. The initial routine came from here : http://www.dailydoseofexcel.co…te-that-requires-a-login/ . Note that you will need to set a couple of References in the VBE.

    Re: Using sendkeys and loop to download files


    Hi,


    It looks as if automation using FireFox is not really an option. There was an attempt to make it usable in the same way as IE by use of a plugin, see here : http://www.adamlock.com/mozilla/ . However, it looks as if that isn't being maintained currently so it may not support the current version of FF.


    Are you sure your webpage won't work with IE? It really would be much easier and safer than using SendKeys (which is basically an accident waiting to happen!).

    Re: Using sendkeys and loop to download files


    Hi and welcome to the forum.


    I don't really want to discourage you but I would strongly urge you not to use SendKeys - it is not a reliable method and will likely get you into trouble at some stage. You would be better advised, IMO, to use an Object variable to refer to InternetExplorer and proceed on that basis. You should then find it easier to navigate the webpage in question. Do you have a particular webpage (so that we can see what you are trying to achieve) or is it a confidential/works page?