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
SpoonerSpooner 

Outlook VBA Question

Hi,

I'm VERY new to the developer side of Salesforce, having used the Salesforce product within our Support department in my current role.

I didn't really know where to post this, but here goes...

I would like to connect to our Salesforce DB from within both Outlook and possibly Excel using the VBA coding area from both.

Could someone explain how I go about this and whether it's possible.  I assume that it is possible from the various threads I've read so far, but if someone could maybe provide some examples of how to connect to the DB as a particular user and extract data from the database that would be great.

Many many thanks!!!!
Roy D.Roy D.

This will work.  Need to add the the referance to the SFDCExceladd-in THE VBA moidule  (Tools, Referances).  Login first via the toolbar.  This saves the username. There after the code can enter the password.

 

Sub Mylogin()
   
    Dim AltKey As String
    Dim CtrlKey As String
    Dim ShiftKey As String
    Dim TabKey As String
    Dim EnterKey As String
    Dim Password1 As String
    Dim UserName As String
   
    '--------------------------
    AltKey = "%"
    CtrlKey = "^"
    ShiftKey = "+"
    TabKey = "{TAB}"
    EnterKey = "~"
    Password1 = ""
    UserName = ""
       
   
    Sheets("Main").Select


 If Not (SFDCExcelAddin.CommandBarRelated.IsLoggedIn) Then
        AppActivate ("Microsoft Excel")
        Application.Wait Now + TimeValue("00:00:03")
        Application.SendKeys "{Tab}"
        Application.Wait Now + TimeValue("00:00:03")
        Application.SendKeys Password1
        Application.SendKeys "{Tab}"
        Application.SendKeys EnterKey
        SFDCExcelAddin.CommandBarRelated.Login
       
    End If
    Application.StatusBar = "Login Complete"
    Application.Wait Now + TimeValue("00:00:03")
    Range("B21").Select
    Application.StatusBar = ""
    Application.Run "RefreshAll"
    
End Sub

 

Sub SF_login()
    Application.StatusBar = " "
    If Not SFDCExcelAddin.IsLoggedIn Then SFDCExcelAddin.Login
    SFDC_Login = SFDCExcelAddin.IsLoggedIn
    Application.StatusBar = "Login to SalesForce Complete"
End Sub

 

 

Sub SF_LogOff()
    If SFDCExcelAddin.IsLoggedIn Then SFDCExcelAddin.Logoff
    SFDC_Logout = SFDCExcelAddin.IsLoggedIn

End Sub

 

 

 

 

Roy Dumlao