Posts by ecawilkinson_home

    The quick fix is to add

    Code
    Exit Sub

    after each Msgbox "Please fill in...field" statement. Not sure why you have the me.TextboxX.SetFocus statements where you do though. They would be better just after the relevant Msgbox statement, so for each text box check:

    Code
    If Trim(Me.TextBoxX.Value) = "" Then
        MsgBox "Please Fill The ... Field!"
        Me.TextBoxX.SetFocus
        Exit Sub
    End If


    HTH

    The Application object in Word does not have a Printer property. Try the following (uses Access's Application object to access the printers):

    Obviously, adjust the above to suit your needs.

    Hi,


    I have a project in which I need to correct multiple large workbooks with worksheets (in database format) that have cells that sometimes resolve to an error, usually #VALUE! and #NA(). As other workbooks use some of the numeric columns in calculations, I need to remove any errors and replace them with a vbnullstring or empty string. I am trying to avoid opening all the workbooks as this can take a few minutes (there are upto 40 at a time). In the past I have used ADO to update cell values in closed workbooks but I cannot manage to make this work when the cell contains an error. When I interrogate the recordset that is linked to the workbook, errors present as a Null value, just like an empty cell. But if I try to change any Null value, I get an this error - Field Cannot be updated. I am able to update other fields and the connection and recordset open properly. Here is my code:

    The error happens on the rs(lCtr) = vbNullstring line. Is there any way I can achieve my goal? I thought that the problem may be that I am trying to change a null type to a string type but I do not know how to change an ADO data type in a recordset that has already been opened. Is there an alternative way not using ADO? Also, (a separate problem), there are a few places in these workbooks that only have a single cell that I want to update. I know how to retrieve a single cell's value using ExecuteExcel4Macro but was wondering if using ExecuteExcel4Macro that is is also possible to SET a single value.


    Sorry for adding in an extra question at the end!


    thanks in advance,

    Chris

    Hi,


    I have a dropdown on the ribbon that contains the names of worksheets. I have worked out how to make it update to include new work sheets in the list as they are created, what I cannot work out how to do is change the width of the dropdown dynamically. I know how to set the width in the customUI.xml file (sizeString property). I want sizeString to be set on-the-fly to the width of the name of the worksheet with the longest name, so that it is small if all the worksheet names are short but longer to accommodate longer names. (I know about invalidating the ribbon to reflect dynamic changes, I just do not know the correct syntax to change the width of the dropdown, or even if this is possible).


    thanks,
    Chris