Skip to content

Instantly share code, notes, and snippets.

@rdaunce
Last active May 23, 2018 17:57
Show Gist options
  • Save rdaunce/e84d7eceb8eb693b03f39db6501ee5ce to your computer and use it in GitHub Desktop.
Save rdaunce/e84d7eceb8eb693b03f39db6501ee5ce to your computer and use it in GitHub Desktop.

Installation

Download and install the Office Tookit 4.0 MSI and the Excel Connector for Profiessional Edition (API 16.0) from https://code.google.com/archive/p/excel-connector/downloads

Preparing to Connect to SalesForce

Additional configuration is required to get everything working properly.

Enable Excel macros

The SalesForce Excel Connector will no run in Excel unless macros are enabled. Due to the security risks that macros pose, it is recommended to enable macros only when using the connector and disable them when fished.

To enable macros, launch Excel and follow these steps:

  1. Click on File => Options to bring up the Excel Option window
  2. Click on the Trust Center item in the left side menu
  3. Click on the Trust Center Settings... button to open the Trust Center window
  4. Click on the Macro Settings item in the left side menu
  5. Click on the Enable all macros (not recommended; potentially dangerous code can run) option
  6. Click on the OK button to close the Trust Center window
  7. Click on the OK button to close the Excel Options window
  8. Close Excel and relaunch

To disable macros, follow the same steps, chosing one of the Disable all Macros... options.

When Excel is relaunched, a new item should appear under the Add-ins top menu. The item should display a drop down list with the title sforce Connector. If you do not see the Add-in, something went wrong with installation that needs to be resolved before continuing.

SalesForce Security Token

The Excel Connector uses your normal SalesForce credentials but has you add a security token to the end of your password. If you already have a SalesForce Token and you know what it is, you can use it. If you don't have one or don't remember it, follow these steps to get a new one:

  1. Login to the SaleForce website.
  2. Click on your Avatar in the upper right and click on the Settings link
  3. Click on the Reset My Security Token item in the left side menu
  4. Click on the Reset Security Token button

The new security token will be emailed to the email address associated with your account.

Updating the Server URL

The SaleForce Connector was created prior to a URL format change implemented by SalesForce. The URL that is used by the connector needs to be updated to the new format to work properly. Unfortunately the SalesForce Connector for Professional Edition disables the URL field using VBA code and the code is protect by a VBA password. To make the required code change, the password needs to be disabled using a VBA Password Removal tool. Note that this can only be done if the SalesForce Connector is installed and loads properly.

Removing the password

The VBA Password can be removed with one of the following tools. Most people will have the 32-bit version of Excel installed. Download the 64-bit version of the tool if you know that you have the 64-bit version installed.

Once downloaded, open the file and perform the following steps:

  1. Click on the View menu item
  2. Click on the Macros button in the ribbon
  3. Choose View Macros to open the Macro Window
  4. Click on the Remove_VBA_Password to highlight it
  5. Click on the Run Button to run the macro

An alert should appear telling you that passwords have been removed.

Enabling changes to the Server URL

To enable editing the server URL, you must edit the VBA code that disables it. Once the code has been unlocked, hit ALT-F11 to open the Microsoft Visual Basic for Applications window. All VBA code is shown in the Project window along the left hand side. Expand the sforce_connector project and then expand the Modules folder. Double-click on the Login item to open the code.

Within the Login code, there is a function named Validate that contains the code to disable the server URL. Look for the following line in that function:

  loginForm.serverurl.Enabled = False

Change it to

  loginForm.serverurl.Enabled = True

Save the change and close the Microsoft Visual Basic for Applications windows. You can now modify the Server URL item when connecting to SalesForce. The change may persist between Excel sessions. If it doesn't, you may need to reapply the code change.

Connecting to SalesForce

To connect to SalesForce, open a new sheet and click on the Add-Ins menu time. Click on the sforce Connector drop down and choose Sforce Table Query Wizard. You should be prompted with a salesforce.com login window. Enter your credentials in the User Name and Password files. Don't forget to add your SalesForce Token to the end of your password. Before attempting to login, you will need to update the Server URL to https://login.salesforce.com/services/Soap/c/16.0. The differences are the change from www to login at the beginning of the URL and the change from 13.0 to 16.0 at the end of the URL.

Once successfully authenticated, the wizard will start and walk you through querying data from a SalesForce table.

Note that this connector is based on an older version of the API and some newer tables are not exposed through it. If you can't find what you are looking for, it might not be accessible using this tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment