Ms word Macro to extract Great Plains Dynamics CRM 2015 Data

Hello,
I have a macro in MS Word that I am trying to use from a remote server (URL)
How do I reconfigure my datasource to utilize a url such as:
http://555.555.00.000/ABCCRM/main.aspx#960021546
Sub LoadOpportunityList()
' LoadOpportunityList Macro
    Set opportunityList = ActiveDocument.SelectContentControlsByTitle("OpportunityNumber").Item(1)
    Dim cnn As New ADODB.Connection
    Dim rst As New ADODB.Recordset
    cnn.Open "Provider=SQLOLEDB;" & _
"Data Source=ABCCRM\DB1;" & _
"Initial Catalog=ABC_MSCRM;" & _
"User Id=sa;" & _
"Password=abc123"
    rst.Open "SELECT DISTINCT ws_opportunitynumber FROM Opportunity WHERE ws_opportunitynumber IS NOT NULL AND StateCode = 0 AND StepName = '2 - Estimating' Order By ws_opportunitynumber;",
cnn, adOpenStatic
    rst.MoveFirst
    With ActiveDocument.SelectContentControlsByTitle("OpportunityNumber").Item(1).DropdownListEntries
.Clear
Do
.Add rst![ws_opportunitynumber]
rst.MoveNext
Loop Until rst.EOF
    End With
    rst.Close
    cnn.Close
    Set rst = Nothing
    Set cnn = Nothing
End Sub
Sub LoadOpportunityDetails()
' LoadOpportunityDetails Macro
    Set opportunityList = ActiveDocument.SelectContentControlsByTitle("OpportunityNumber").Item(1)
    Call GetOpportunityDetails(opportunityList.Range.Text)
End Sub
Private Sub GetOpportunityDetails(OpportunityName As String)
    Dim cnn As New ADODB.Connection
    Dim rst As New ADODB.Recordset
    cnn.Open "Provider=SQLOLEDB;" & _
"Data Source=Server1\DB1;" & _
"Initial Catalog=ABC_MSCRM;" & _
"User Id=sa;" & _
"Password=abc123"
     rst.Open "SELECT TOP 1 * FROM WS_PROPOSALDATA Where ws_opportunitynumber ='" & OpportunityName & "';", _
cnn, adOpenStatic
'    rst.Open "SELECT TOP 1 Address1_Street1, Address1_Street2 FROM OpportunityBase Where Name ='" & OpportunityName & "';", _
cnn, adOpenStatic
    rst.MoveFirst
    Set proposaldate = ActiveDocument.SelectContentControlsByTitle("ProposalDate").Item(1)
    Set projecttype = ActiveDocument.SelectContentControlsByTitle("ProjectType").Item(1)
    Set projectname = ActiveDocument.SelectContentControlsByTitle("ProjectName").Item(1)
    Set opportunitycontact = ActiveDocument.SelectContentControlsByTitle("OpportunityContact").Item(1)
    Set customerquoteto = ActiveDocument.SelectContentControlsByTitle("CustomerQuoteTo").Item(1)
    Set quotetoaddress1 = ActiveDocument.SelectContentControlsByTitle("QuoteToAddress1").Item(1)
    Set quotetoaddress2 = ActiveDocument.SelectContentControlsByTitle("QuoteToAddress2").Item(1)
    Set quotetocity = ActiveDocument.SelectContentControlsByTitle("QuoteToCity").Item(1)
    Set quotetostate = ActiveDocument.SelectContentControlsByTitle("QuoteToState").Item(1)
    Set quotetozip = ActiveDocument.SelectContentControlsByTitle("QuoteToZIP").Item(1)
    Set billtocustomer = ActiveDocument.SelectContentControlsByTitle("BillToCustomer").Item(1)
 '   Set billtoaddress1 = ActiveDocument.SelectContentControlsByTitle("BillToAddress1").Item(1)
 '   Set billtoaddress2 = ActiveDocument.SelectContentControlsByTitle("BillToAddress2").Item(1)
 '   Set billtocity = ActiveDocument.SelectContentControlsByTitle("BillToCity").Item(1)
 '   Set billtostate = ActiveDocument.SelectContentControlsByTitle("BillToState").Item(1)
 '   Set billtozip = ActiveDocument.SelectContentControlsByTitle("BillToZIP").Item(1)
    Set locationcustomer = ActiveDocument.SelectContentControlsByTitle("LocationCustomer").Item(1)
    Set locationaddress1 = ActiveDocument.SelectContentControlsByTitle("LocationAddress1").Item(1)
    Set locationaddress2 = ActiveDocument.SelectContentControlsByTitle("LocationAddress2").Item(1)
    Set locationcity = ActiveDocument.SelectContentControlsByTitle("LocationCity").Item(1)
    Set locationstate = ActiveDocument.SelectContentControlsByTitle("LocationState").Item(1)
    Set locationzip = ActiveDocument.SelectContentControlsByTitle("LocationZIP").Item(1)
    Set contactname = ActiveDocument.SelectContentControlsByTitle("ContactName").Item(1)
    Set contactemail = ActiveDocument.SelectContentControlsByTitle("ContactEmail").Item(1)
    Set contactphone = ActiveDocument.SelectContentControlsByTitle("ContactPhone").Item(1)
    Set servicemgrname = ActiveDocument.SelectContentControlsByTitle("ServiceMgrName").Item(1)
    Set servicemgremail = ActiveDocument.SelectContentControlsByTitle("ServiceMgrEmail").Item(1)
    Set servicemgrphone = ActiveDocument.SelectContentControlsByTitle("ServiceMgrPhone").Item(1)
    Set customerservicename = ActiveDocument.SelectContentControlsByTitle("CustomerServiceName").Item(1)
    Set customerserviceemail = ActiveDocument.SelectContentControlsByTitle("CustomerServiceEmail").Item(1)
    Set customerservicephone = ActiveDocument.SelectContentControlsByTitle("CustomerServicePhone").Item(1)
    Set technicianname = ActiveDocument.SelectContentControlsByTitle("TechnicianName").Item(1)
    Set technicianemail = ActiveDocument.SelectContentControlsByTitle("TechnicianEmail").Item(1)
    Set technicianphone = ActiveDocument.SelectContentControlsByTitle("TechnicianPhone").Item(1)
    Set Location = ActiveDocument.SelectContentControlsByTitle("Location").Item(1)
    Set ProposalNumber = ActiveDocument.SelectContentControlsByTitle("ProposalNumber").Item(1)
    proposaldate.Range.Text = rst![ws_proposaldate]
    projecttype.Range.Text = rst![ws_bidtype]
    projectname.Range.Text = rst![Name]
    opportunitycontact.Range.Text = rst![ws_endcustomercontactidname]
    customerquoteto.Range.Text = rst![QuotedToName]
    quotetoaddress1.Range.Text = rst![QuotedToaddress1_line1]
    quotetoaddress2.Range.Text = rst![QuotedToaddress1_line2]
    quotetocity.Range.Text = rst![QuotedToaddress1_city]
    quotetostate.Range.Text = rst![QuotedToaddress1_stateorprovince]
    quotetozip.Range.Text = rst![QuotedToaddress1_postalcode]
    billtocustomer.Range.Text = rst![BillToName]
 '   billtoaddress1.Range.Text = rst![BillToaddress1_line1]
 '   billtoaddress2.Range.Text = rst![BillToaddress1_line2]
 '   billtocity.Range.Text = rst![BillToaddress1_city]
 '   billtostate.Range.Text = rst![BillToaddress1_stateorprovince]
 '   billtozip.Range.Text = rst![BillToaddress1_postalcode]
    locationcustomer.Range.Text = rst![Location]
    locationaddress1.Range.Text = rst![ws_Address1]
    locationaddress2.Range.Text = rst![ws_Address2]
    locationcity.Range.Text = rst![ws_Addresscity]
    locationstate.Range.Text = rst![ws_Addressstate]
    locationzip.Range.Text = rst![ws_AddressZip]
    contactname.Range.Text = rst![MaintenanceSalesRepfullname]
    contactemail.Range.Text = rst![MaintenanceSalesRepemailaddress1]
    contactphone.Range.Text = rst![MaintenanceSalesReptelephone1]
    servicemgrname.Range.Text = rst![AreaServiceManagerfullname]
    servicemgremail.Range.Text = rst![AreaServiceManageremailaddress1]
    servicemgrphone.Range.Text = rst![AreaServiceManagertelephone1]
    customerservicename.Range.Text = rst![CustomerServiceRepfullname]
    customerserviceemail.Range.Text = rst![CustomerServiceRepemailaddress1]
    customerservicephone.Range.Text = rst![CustomerServiceReptelephone1]
    technicianname.Range.Text = rst![Technicianfullname]
    technicianemail.Range.Text = rst![Technicianemailaddress1]
    technicianphone.Range.Text = rst![Techniciantelephone1]
    Location.Range.Text = rst![Location]
    ProposalNumber.Range.Text = rst![ProposalNumber]
'    Set street1 = ActiveDocument.SelectContentControlsByTitle("Address1").Item(1)
'    Set street2 = ActiveDocument.SelectContentControlsByTitle("Address2").Item(1)
'    street1.Range.Text = rst![Address1_Street1]
'    street2.Range.Text = rst![Address1_Street2]
    rst.Close
    cnn.Close
    Set rst = Nothing
    Set cnn = Nothing
End Sub
John

Hi,
    Use the config file in your project as explained below.
https://msdn.microsoft.com/en-us/library/16e74h9c.aspx?f=255&MSPPError=-2147217396
Hope this helps.
Minal Dahiya
blog : http://minaldahiya.blogspot.com.au/
If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful"

Similar Messages

  • Dynamics CRM 2015 : Email editor

    Dear all,
    Can anyone confirm if the email editor comes with the Dynamics CRM 2015 On-premise version and Online version?
    I have many reviews saying that we have email editor in the Dynamics CRM 2015 version but I am unable to find it.
    Any help/ guide would be greatly appreciated.
    Many Thanks & Regards
    Vinay

    Hello Vinay,
    The emal editor is only available with MDM (Microsoft Marketing). Check this out for reference.
    https://community.dynamics.com/crm/f/117/t/151513.aspx
    Regards
    Abhishek
    Abhishek Bakshi

  • Restrict access to Dynamics CRM 2015 to only company laptops or Ipads

    Dear all,
    I have deployed MS Dynamics CRM 2015 server on premise and I want to restrict access to company laptops only.
    All company laptops are joined to my domain.
    Any guide/help would be greatly appreciated.
    Many Thanks & Regards
    Vinay

    CRM has no specific functionality to restrict access to certain machines, but you may be able to achieve this by more general functionality. One option is to block the Crm url on specific client machines, as per the previous post, but that only works for
    known machines.
    Another option could be to add restrictions in IIS on the Crm Server. This can restrict access to only certain IP addresses, but that would only work if the laptops always connect via a known set of IP addresses - this is probably OK if they're always connected
    via a company network, either directly, or via a VPN
    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

  • Dynamics crm 2015 : Portal Deployment / development - external users autehntication

    Dear all,
    I have just deployed my dynamics crm 2015 on-premise version.
    I would like to get some tips/guide about how to authenticate external users through portal to CRM.
    Example, I want my external users to be able to log case request through portal.
    Any help would be greatly appreciated.
    Thanks & Regards
    Vinay

    I recommend reading the SDK's Walktrough:
    Building a Web App
    After that, I'd check out the 311 Accelerator  in CodePlex

  • Dynamics CRM 2015 Install requires Active Directory on VM Windows 2012 R2 Server

    Hello,
    I'm trying to install Dynamics CRM 2015 on a standalone VM not connected to a domain (it's running under WIndows 8.1 Professional). The VM was configured using WIndows Server 2012 R2. I'm getting an error message shortly into the install process stating
    it needs to access Active Directory.
    How can I get around this issue - I just want to Install this CRM on the VM without getting into complicate network/AD issues.
    Can you please advise ?
    SO many thanks,
    John

    CRM requires AD no way around that so the most likely solution is to install it on that server or on a VM not connected to your other networks
    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

  • Do you have support to integrate echosign with Dynamics CRM 2015, If Not, When it will be possible.?

    Do you have support to integrate echosign with Dynamics CRM 2015, If Not, When it will be possible?

    Hey Mantas,
    Do not expect that feature any time soon. I do not even see that being a feature this year.
    Considering all that is going on and required to be finished and sorted a lot more is/will need to be done.
    In terms of what you can do I have done things like used the refer a friend form which you can style and use that to send emails out to the needed people. I have submitted multiple web forms with ajax etc as well.
    You have the custom fields for the people and emails (if not you can add them) and you can use those to send emails off to people, you just do not have a workflow so your not pestered with it but the notification message is the one that goes out and can have a template applied.
    So there is a number of things you can do to get that going along those lines. I have done a few variations of this on different sites.
    Warning note though - Ajax submission for custom web forms has a total character limit (all fields) of 1024 characters, which is not a lot.

  • Dynamics CRM 2015 developer Class

    I am looking for a Dynamics CRM 2015 developer taining/class. My company will pay for the course and I am located in Washington, DC/Virginia./Maryland area. Any in class recommendations?

    Hello,
    I believe first step is to Download Log File and recheck it for error.
    Dynamics CRM MVP/ Technical Evangelist at
    SlickData LLC
    My blog

  • Dynamics crm 2015 import fail entity ribbon XML data that represents the customized elements of the ribbon for an enitity" error.

    while import the solution into dynamics crm 2015.import fail is getting.could anybody help me on this.
    hsk srinivas

    Hello,
    I believe first step is to Download Log File and recheck it for error.
    Dynamics CRM MVP/ Technical Evangelist at
    SlickData LLC
    My blog

  • Microsoft Dynamics CRM 2015 online (AD requirements)

    Hi all,
    we are currently looking to setup a CRM 2015 online environment.
    I tried looking in the Technet articles but couldn't find an answer.
    Do we need to forsee Active directory groups (such as PrivUserGroup, SQLAccessGroup,...) like we do for the On premise version?
    And do we need to give a license, or does this come with the Office 365 license?
    Any help would be highly appreciated.
    Regards,

    Got a call from MS support, its across the entire service. They are working hard to fix meanwhile they provided a work around I am not sure if it will work for everyone but 
    https://ORGNAME--s.crm4.dynamics.com worked for me. Or variations where --d becomes --s
    so that is the normal url https://ORGNAME.crm4.dynamics.com/ you take the orgname and add --d or --s followed by crm4.dynamics.com 
    Only works in IE 
    teach a man to fish ... etcetera

  • Mailbox is disabled in MS Dynamics CRM 2015 Online

    Hi All,
    I am getting below error, I reconfigured my mailbox to "Server Side Synchronization" and provided MS Exchange Online/ my company's email Id. But did not suceed throughh. Any solution please
    Your mailbox Lalit has been disabled for receiving email. Make sure
    that the credentials specified in your mailbox record are correct and have sufficient permissions for receiving email. Then, enable the mailbox for email processing.

    Hi,
    We can :-)
    I will try to find a better forum in the list and move it
    Good luck :-)
      Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]

  • Dynamics crm 2015 unexpectedly deleted associated view for custom entity

    i  have contact and custom entity.it has associated view.unfortunately i deleted associated view.while exporting the solution export fail how can i resolve this one.any help would be highly appreciated.
    hsk srinivas

    Do you have the view in another environment (e.g. PROD)?  If so, you can create a new Solution there and just add the entity to the solution and Export/Import it back to your "broken" environment.

  • Working with Word Templates and signed Word macros storing documents in SAP

    HI,
    we are storing word documents in the SAP BDS. The documents contain macros. The security settings for word macros cannot be reduced in our environment.
    So the documents / macros were signed. They work well. but as soon as they have been stored in the SAP BDS, we get the error message "You have modified a signed project.You do not have the correct key to sign this project. The signature will be discarded"
    After that the word macros do not run.
    Does anybody know this problem and the solution?
    Regards
    Harald

    And this is related to workflow in what way?
    Regards,
    Martin

  • MS-Word Macros with paramers via OLE

    Hi,
    This is probably more of an MS-Word question than a Forte question,
    but somebody out there might have done this before...
    I have some MS Word macros (Originally WordBasic, but recently they
    underwent automatic conversion to become Visual Basic) which take
    parameters.
    I used to call these macros from Forte using DDE.
    These days, it's a lot more fashionable to use OLE automation than
    DDE so I thought I'd give that a go.
    But I can't.
    Word.Applicaiton has a Run() method to run macros, but not macros
    with parameters. Is there a neat way of getting macro parameters
    across to Word?
    - Ed.
    Eduard E Havelaar | For the foolishness of God is wiser
    Information Services Section | than man's wisdom, and the weakness
    University of Canterbury | of God stronger than man's strength
    Christchurch, New Zealand | - I Cor 1:25

    have a look at this here article:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • Word macro from Forms

    How can I start a macro in Word from Forms with the DDE-package? For Excel I use this command ('update' is the macro-name):
    DDE.Execute(ConvID, [run "'test.xls!update"]', 10000);
    Does anybody know the right approach for a Word macro?
    Thanks.
    null

    You should use OLE2 instead of DDE.
    Use this procedure if you're using Word version >= 97:
    PROCEDURE RUN_MACRO(cMacroName VARCHAR2) IS
    objWordApp OLE2.OBJ_TYPE := OLE2.CREATE_OBJ('WORD.APPLICATION');
    objArgList OLE2.LIST_TYPE := OLE2.CREATE_ARGLIST;
    BEGIN
    OLE2.ADD_ARG(objArgList,cMacroName);
    OLE2.INVOKE(objWordApp,'Run',objArgList);
    OLE2.DESTROY_ARGLIST(objArgList);
    OLE2.INVOKE(objWordApp,'QUIT');
    OLE2.RELEASE_OBJ(objWordApp);
    END;
    you can contact me for further explanation.
    Carlos

  • Making and running excel or word macros

    i would like to make a excel or word macro and run it in labview, but
    i don´t want to run without view the code directly in labview because
    i will need to modify the code in order to do differents things
    depending of the choose that i can make when the program it´s running
    so the answer is: how can i see the macro code in labview in and excel
    or word application and how to run it?
    don´t answer the solution it´s easymacro.com, couse i am a student and
    i need to see the diagram in order to learn
    thanks!

    I think ActiveX is what you need, but you'll have to elaborate a bit to modify and run macros. Look at the examples shipped with LabVIEW about controlling Excel, and see how those work. After that, you'll see that almost anything can be done using ActiveX.
    Good luck

Maybe you are looking for

  • EXCEPTION_ACCESS_VIOLATION in GetNlsSectionName??

    On WIndows XP I sometimes (about 10% of the time) get: An unexpected exception has been detected in native code outside the VM. Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x7C8189BE Function=GetNlsSectionName+0xD5D Lib

  • WiFi Sync no longer works

    I've had wifi sync succefully work on my iPhone 4 since iOS 5 was first released but it recently stopped working. I didn't notice at first because I rarely use it. I'm using a Windows 7 64 bit desktop. I'm not sure what the problem is I first tried d

  • Alv total problem

    Hi, all i have one problem is alv.... what is the statement should i write to get sub total.. for eg.... xxxxxxxxxxxxxx    123123                              123123 subtotal                  642642 in this way....my total should come WA_ALV_FIELDS-T

  • EPAgent in CRM 5. is not visible in SMD

    Hello, I have connected a CRM 5.0 in my solman with the CRM server and CRM java components (CRM java associated to a JAVA system). When i run setup wizard in http://xxxxx.xx.xx:xxx/smd -> diagnostics setup->managed systems->setup wizard    the manage

  • J2EE deployment

    Hi, I'm just starting to look at running CFMX7 apps on a J2EE app server (IBM WebSphere in this case), and I have a concern about deployment. I know that it's very easy to create an .ear or .war file using CF Admin and then deploy that file on the J2