Posts by John_w

    I've never seen anything like that either. It seems to be a very clever way of thwarting automated web scraping because the Results 'table' isn't a HTML table with rows and columns, and neither is the data structured in a parent-child hierarchy that would be easy to parse.


    Instead, the data values are arranged randomly in the HTML within < text > elements with the x and y attributes specifying the position of each data value.


    What code have you tried so far?

    Payment received, thanks.


    Here is the code. It processes the data on the first sheet in the active workbook, so you must open your data workbook and have it as the active workbook and run the macro.


    Re: excel vba picture in cell to header


    Welcome to Ozgrid forums.


    I have several workbooks which use the Save_Object_As_Picture routine, and the code worked correctly when running Excel 2007 on a relatively slow Windows XP machine. However since upgrading to Excel 2016 and a fast (Intel i7 6700) Windows 10 machine I've found that the image/picture created by the code is empty.


    The solution is to Activate the temporary chart, like this:


    Code
    With temporaryChart
            .Activate                                'Required, otherwise image is blank with Excel 2016 or fast CPU (?)
            .Border.LineStyle = xlLineStyleNone      'No border
            .Chart.Paste
            .Chart.Export imageFileName
            .Delete
        End With

    If you tell us which version of Excel and Windows you're using and your computer's CPU this will help to pinpoint the reason why the Activate is needed.

    Re: Conditional syntax for 32-bit &amp; 64-bit Declare Statement


    Try this:


    Re: Run-time error '1004' in Pivot 10$


    Here is your workbook with your original pivot field items intact and my macros added to Module1. I have added a MsgBox statement to show the FixPivotField macro deleting the pivot field item "54360".


    https://drive.google.com/open?…6jC_48aIHdUTdLVVpJbzNpN2M


    Run the FixPivotField macro.


    Then run your UserForm1 from the VBA editor, enter 1234 in the input box and click Login. Your code now runs without error.

    Re: Run-time error '1004' in Pivot 10$


    Payment received, thanks.


    The error displayed is:
    [INDENT]Run-time error '1004':


    Unable to get the PivotItems property of the PivotField class
    [/INDENT]

    If you click Debug on the error message the following VBA line is highlighted in yellow:


    Code
    .PivotItems("54360").Visible = False


    The error occurs because there are two pivot items named "54360", one with 298 records and one with 0 records. I don't know how to delete the zero item using the Excel GUI (only 1 "54360" item is shown in the "Cost Center" filter items list), so here is code which deletes the "54360" pivot item with 0 records:


    Put the above code in a standard module (not the UserForm1 module) and run the FixPivotField macro.


    After running my macro, your userform code runs without error.


    Here is more general code which deletes all pivot items in the "Cost center" pivot field which have 0 records.


    On your posted workbook the above code found and deleted the pivot field named "(blank)" with 0 records. You can adapt the above code for other pivot tables and pivot fields by changing "PivotTable7" and "Cost center" as needed.


    Edit: I said: "found and deleted the pivot field named "(blank)"". Actually, it doesn't delete it because the "(blank)" field it still there when you run the code again. It seems that the "(blank)" field can't be deleted.

    Re: Run-time error '1004' in Pivot 10$


    The fix is for the specific error and workbook you posted. I will provide a more general fix which you can adapt to fix other errors with the same error message which are caused by the same underlying problem.

    Re: Run-time error '1004' in Pivot 10$


    I have analysed the error and produced a fix. I'll PM my payment details and on receipt of payment will post the solution here.


    Have you paid 10% of the fee to Ozgrid?

    Re: Macro for saving copy as csv with incremental file number


    Try runnng the Save_CSV_Sheet macro in the attached workbook, which is your workbook changed to a macro-enabled workbook (.xlsm file).


    forum.ozgrid.com/index.php?attachment/73742/


    The file001.csv, file002.csv, etc. files are created in the same folder as the workbook.


    Re: Macro for saving copy as csv with incremental file number


    I haven't looked at your workbook. Here is a function which returns the next sequential file name, where the "<n>" in the string argument passed to it is replaced by 001, 002, etc.



    Here's how to call it:

    Code
    Public Sub Test()
        Dim csvFileName As String
        csvFileName = GetNextFileName("C:\folder\path\to\file<n>.csv")   'change folder path as necessary
        MsgBox "Next file name is " & csvFileName
    End Sub

    Re: Populate / Fill website form with data from excel rows ($45.00)


    SMC - thanks for the offer of your code, however I won't need it because I've got the whole thing working, including the file uploads.


    As you've spent time on this task I think it is only fair that we share the remaining payment 50:50. Let me know if you're happy with this.