function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BKBK 

Update office toolkit not working

Hi, im trying to update records directly through the office toolkit. I am able to query records with SOQL but everytime I click "Update" i get the error foghorn_test.xls could not be found. If I need to remap the update button who do i do this?? thanks guys

 

BK

ScotScot

BK,

I may be wrong, but I think the intent of the "OfficeToolkitExcel_Test.xls" file was to show sample code to help us get started, rather than a complete generic tool. If you're looking for a generic tool, the Sforce Connector would be a better bet.  On the other hand, this test.xls file is much easier to browse for techniques than the more robust connector.

That said, this sample was originally built and tested under the name "foghorn_test.xls", and then renamed for distribution to "OfficeToolkitExcel_Test.xls". The generated toolbar still refers to the earlier name. If you want to get the sample code executing out of the box, the simplest solution is to rename the file back to "foghorn_test.xls". 

Alternatively, you can fix the OfficeToolkitExcel_Test.xls by:
   1) edit the visual basic macro "Workbook_Open" located in "ThisWorkbook", changing all references from "forghorn_test" to OfficeToolkitExcel_Test".  (Excel: Tools/Macro/Visual basic editor || VBA: VBAProject (OfficeToolkitExcel_Test.xls) || ThisWorkbook (open it with a double click) || replaces...)
   2) delete the existing toolbar named "Foghorn Sample". (Excel: View/Toolbars/Customize || Foghorn Sample || Delete)
   3) Close and reopen the OfficeToolkitExcel_Test.xls

(Workbook_Open tests to see if the toolbar already exists. If not, it builds it, establishing references explicitly to the foghorn_test.xls).

Scot

BKBK

does this mean I change all instances of foghorn test in the code to officetoolkit.xls? I went to the module and did 4 replacements. Also, if i get rid of the foghorntest toolbar then how do i launch the update macro? I hope i am doing this the correct way. Im a llittle biut confused what i do here VBAProject (OfficeToolkitExcel_Test.xls) || ThisWorkbook (open it with a double click) || replaces...)

thanks again

ScotScot

BK,

I don't know what 4 instances you found ... there were eight in mine.

If you're having trouble with this, I strongly recommend that you
   1)
rename the original file back to foghorn_test.xls and use it as-is.
   2) remember that this is only sample code; it is not part of the toolkit itself.

If you still want to edit it, you're looking for:

Private Sub Workbook_Open()
    If Not CommandBarExists("Foghorn Sample") Then
        Dim cmdBar As CommandBar
        Set cmdBar = CreateCommandBar("Foghorn Sample")
        CreateCommandBarButton cmdBar, "&Login", "foghorn_test!LoginMacro"
        CreateCommandBarButton cmdBar, "&Query", "foghorn_test!QueryMacro"
        CreateCommandBarButton cmdBar, "&Search", "foghorn_test!SearchMacro"
        CreateCommandBarButton cmdBar, "&Update", "foghorn_test!UpdateMacro"
        CreateCommandBarButton cmdBar, "&Create", "foghorn_test!CreateMacro"
        CreateCommandBarButton cmdBar, "&Delete", "foghorn_test!DeleteMacro"
        CreateCommandBarButton cmdBar, "&Get Updated", "foghorn_test!GetUpdatedMacro"
        CreateCommandBarButton cmdBar, "G&et Delted", "foghorn_test!GetDeletedMacro"
        cmdBar.Visible = True
        cmdBar.Position = msoBarTop
    End If
End Sub

You change all the parts I highlighted in red by the name of the Excel file.

I have discovered one additional problem with the sample excel file ... as distributed it was named "tookit" rather than "toolkit" -- if you edit the procedure and save it as the same name, make sure you put Tookit, not Toolkit, in the red places.

Scot

BKBK

hey scott,

thanks for the code sample. I changed it to the following:

Private Sub Workbook_Open()
    If Not CommandBarExists("Foghorn Sample") Then
        Dim cmdBar As CommandBar
        Set cmdBar = CreateCommandBar("Foghorn Sample")
        CreateCommandBarButton cmdBar, "&Login", "OfficeTookitExcel_Test!LoginMacro"
        CreateCommandBarButton cmdBar, "&Query", "OfficeTookitExcel_Test!QueryMacro"
        CreateCommandBarButton cmdBar, "&Search", "OfficeTookitExcel_Test!SearchMacro"
        CreateCommandBarButton cmdBar, "&Update", "OfficeTookitExcel_Test!UpdateMacro"
        CreateCommandBarButton cmdBar, "&Create", "OfficeTookitExcel_Test!CreateMacro"
        CreateCommandBarButton cmdBar, "&Delete", "OfficeTookitExcel_Test!DeleteMacro"
        CreateCommandBarButton cmdBar, "&Get Updated", "OfficeTookitExcel_Test!GetUpdatedMacro"
        CreateCommandBarButton cmdBar, "G&et Delted", "OfficeTookitExcel_Test!GetDeletedMacro"
        cmdBar.Visible = True
        cmdBar.Position = msoBarTop
    End If
   
End Sub 

However, when i lunch the update macro buttonclick() i get this error:

"The macro C:/Documents........OfficeTookitExcel_Test!'UpdateMacro' cannot be found

ScotScot

BK,

Evidently the method used for setting up the command bars only works if the file is in your default Excel directory. In my case, I had it in my "My Documents" directory, and it worked fine. I moved it to another directory and got the same error as you did.  Moved it back to My Documents, and it worked again.

I suspect you could get it to work by moving it to the directory that it reports in the error message.

I am sorry, but I don't know enough about the commands used for building the command bar to be able to help you further.

Perhaps one of the salesforce people who built this example may be able to give you more help.

Scot

 

BKBK

scott,

i think it's gonna work but when i run it this time i get the error "retrieve id limit reached" When i hit debug it goes to the following line of code     Set qrs = sfdc.Retrieve(fieldList, "Contact", idList, False)

ScotScot

I suspect that you're trying to do a retrieve on more than 2000 instances. This is a documented limit (see the Web Services Developer's Guide). An application which expects to retrieve more than 2000 would need to batch the ids and retrieve 2000 at a time.