Connecting to the DI from MS Excel

This code snippet works fine from vb.net, however, I can't get a connection from Excel.  I added a reference to SAPbobsCOM.  Everything is fine up until I call .connect.
Sub MyMacro()
    Dim vCompany As SAPbobsCOM.Company
    Set vCompany = New SAPbobsCOM.Company
    'set parameters for connection
    vCompany.CompanyDB = "MyCompany"
    vCompany.Password = "MyPassword"
    vCompany.UserName = "MyUsername"
    vCompany.Server = "MyServer"
    vCompany.UseTrusted = False
    vCompany.DbUserName = "MyDBUsername"
    vCompany.DbPassword = "MyDBPassword"
    vCompany.Connect
    If vCompany.Connect <> 0 Then
        MsgBox "Failed to connect"
            Exit Sub
    End If
End Sub
Any ideas?
TIA

Avi - thans for the response. The .connect method of the company object looks like it returns a Long. 
In my case, it's returning a -116 which means I am not connecting. 
Company.Connect Method Syntax
Public Function Connect() As Long
Returns
Returns a result value that indicates success or failure. If the method succeeds, it returns 0. Otherwise, it returns an error code.
You can retrieve the last error code and its description using the method GetLastError
If I call GetLastError, it returns a 0 indicating a no error condition.
Does anyone have a working VBA macro for excel that includes the connection? 
All I did to prep was add a reference to the DI.  Do I have to reference any other objects?  I can run SQL queries from Excel in the standard manner.
Thanks in advance!

Similar Messages

  • How to put the data from one excel sheet in another excel sheet

    hi ,
    I want put the data from one excel sheet in another excel sheet in seq. order Eg: I have one excel sheet in which i have 3 col. Name , Sno. , Email along with data .I want to put data from this sheet to another excel sheet in the following orders of col. Sno,Name, Email .
    While loading data in another sheet , i have to perform validation like char field should n't contain numeric values and vice versa .
    Let me know on this soon ..
    regards
    Prashant

    Well, you can issue separate queries with the ordering you need from each tab in the spreadhseet. You can open an ODBC connection from a VBA macro, select a sheet, run a query, select another sheet and run another query. As for the validation, you can do this in Oracle via stored procedures or again in VBA code.

  • I can no longer connect to the internet from any other device.

    Having successfully upgraded to OS X Mavericks from Snow Leopard I can now no longer connect to the internet from  any other device.  I have an iPhone 4S, a Galaxy Tab, and an internet radio, none of which can connect to the internet since the upgrade.  They connect to my BT Home Hub without a hitch, it’s just that they do not connect at all to any website.  All was fine before the update. 
    The upgrade was to my iMac and that’s fine, no connection or surfing issues. 

    Hi t0ad1e,
    The article below may be able to help you troubleshoot your Wi-Fi issue with the iPhone:
    iOS: Troubleshooting Wi-Fi networks and connections
    http://support.apple.com/kb/TS1398?viewlocale=en_US
    Reset network settings by tapping Settings > General > Reset > Reset Network Settings.
    Note: This will reset all network settings including
    previously connected Wi-Fi networks and passwords
    iOS and OS X: Recommended settings for Wi-Fi routers and access points
    http://support.apple.com/kb/HT4199
    I hope this information helps ....
    Have a great day!
    - Judy

  • I have a iMac with a built in airport extreme card.  Does the imac act as a wireless router so that I can connect to the internet from my iPad by tethering through my iMac?

    I have a iMac with a built in airport extreme card.  Does the imac act as a wireless router so that I can connect to the internet from my iPad by tethering through my iMac?

    Depends which iMac exactly and your network setup, you can go into System Preferences and under the Sharing pane you can enable internet sharing from ethernet (or whereever you get your internet from) to Wi-Fi.

  • Cannot connect to the internet from my MAC on WRT160Nv2 - no problems connecting from my PC

    Hi,
    I have just bought a WRT160Nv2, but I am having problems connecting to the internet from my MAC (a powerbook with OS X) when I connect to the router wirelessly. If I try from my PC the Internet works fine. Also if I connect the MAC directly to the routers LAN port, the Internet works.
    When I connect wirelessly from the MAC I do get an IP adress, and I am able to access the routers web configuration page. I can also see that the correct DNS gets assigned, so I am low on suggestions to what could be the problem.
    Currently I have the router set up to WPA2 encryption, but I have tried different settings, e.g. no security at all with the same result.
    I just tried upgrading to the newest firmware (WRT160Nv2_v2.0.02_008), also with no luck.
    Also I should mention that the MAC can connect to other wireless connections without problems, e.g. my previous ZyXel DSL router. 
    Any ideas to what could be the problem?
    Thanks,
    Rasmus

    Well maybe WPA2 Security is not compatible with Mac so change the Security mode to WEP or WPA and prepare security key of 10 digit password and while connecting to the wireless network on Mac type a $ sign first followed by the 10 digit passoword and it should work.

  • Safari doesn't connect to the internet from my mailbox or from Google. I use a MAC, OS X version 10.8.4

    My MAC desktop doesn't connect to the internet from an email or from  safari.  Only the first few letters of the web address I want to use appears in the address bar and then the wheel spins and spins non-stop.  Thanks for any suggestions on how to fix this problem.

    Power off the router. Wait awhile. Power it back on. Wait until all the lights are lit up properly.
    It will take a while.
    Restart the computer.
    Start up in Safe Mode
    http://support.apple.com/kb/PH11212
    Best.

  • Data Model damaged, Cannot connect to Access 2013 from within Excel 2013

    Hello,
    Recently I am not able to use PowerPivot for Excel 2013 and I cannot connect to my Access 2013 database tables from within Excel 2013. Whenever I try to click on a slicer in my Excel worksheet, it gives me the following error: "Excel was unable to load
    a necessary component. This component might have been damaged or deleted. Reinstall the client software or data source driver software for your database."
    I am using Microsoft Office Pro Plus 2013 on Windows 7, 64-bit version. I have tried reinstalling Microsoft SQL Compact Edition 2005 and reinstalling Office 2013. I have run out of ideas and am a loss what to do next ? 
    Can anyone help point in the right direction for a possible solution to this problem ??? 
    Would appreciate all help.
    Thank you.
    ~Maneesh
    The problem with being punctual is, there's nobody there to appreciate it !!!

    Hi
    This is the forum to discuss questions about apps for office develop. For your question is more about Excel, I will move this thread to the TechNet forum for
    Excel
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly
    can either share their knowledge or learn from your interaction with us.
    Thank you for your understanding.
    Best Regards
    Lan
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to read the data from an excel file into MYSQL by java language

    Hi all,
    I have some data in excel spread sheet and I want to put the data into MYSQL data base. I created the tables in MYSQL> How can I write a program in JAVA that puts the value from excel sheet to mysql??
    I would appreciate your help
    regards

    By typing code at the keyboard... but presumably you meant to ask what code you should type.
    To get data out of Excel there are a few alternatives. The Google keywords I would use to find them are "java excel". I use Apache POI but there are other possibilities, I believe. As for getting the data into MySQL once you have extracted it from Excel, you would use JDBC. But you already knew that, didn't you? You did find the JDBC forum.
    In general it's better to ask a specific question on a forum. If you don't have a clue (which is the way we all start out) then just telling people that isn't going to be helpful. The best you're going to get is links to tutorials, which you could perfectly well have found for yourself by simple web searches.

  • Is there any way to read the data from an excel file w/o using a loop structure?

    I am retrieving a large amount of data (multiple sheets) from an excel file and would like to extract the entire range without retrieving individual cell values(too slow). I can write an range all at once but cannot read it.

    If you are able to write a block of data, then you should be able to read a block. The four requirements that you want to verify are:
    1. The Range specified must match the exact size and location of the data block you want to read
    2. The returned data is in a 2D array of Variants (either strings or numbers)
    3. Use Variant to Data to convert to 2D DBL or 2D Strings
    4. Check for the correct orientation for your application (use transpose if it is not)
    Michael Munroe
    Certified LabVIEW Developer
    www.abcdef.biz
    Michael Munroe, ABCDEF
    Certified LabVIEW Developer, MCP
    Find and fix bad VI Properties with Property Inspector

  • How to export the data from an excel file to Oracle database by using macro

    Hi,
    I want to export data from an excel file into Oracle database.There is one method that by creating the macros through excel we are able to do this.
    can anybody please send me the code to create macros?
    Thanks in advance.
    Regards,
    Surendra.V

    There are several resources on the web, but you could start analyzing if this code fits your needs --> VBA Macro for Excel 2003 Export of Text File with Comma and Quote Delimiters.
    ~ Madrid

  • Error while connecting to the database from a JSP Page

    Hi,
    I am using a simple JSP page which is based on the sample JSP pages from OTN.
    When I try to connect to my database using the following code:
    InitialContext ic = new InitialContext();
    OracleDataSource ds = (OracleDataSource)ic.lookup("jdbc/OTN9iDS");
    m_connection = ds.getConnection();
    I get the following error:
    Naming exception Error while connecting to the database : javax.naming.NameNotFoundException: jdbc/OTN9iDS not found in JDBCTest-JDBCTestProject-webapp
    Does anybody know wht this is happening?
    Any help would be appreciated
    FRank

    Hi Frank,
    Are you using standalone OC4J or 9iAS ? If you are using standalone OC4J then you need to add a proper data source entry in %OC4J_HOME%j2ee\home\config\data-sources.xml file.
    If you are using 9iAS the you can log in to the Enterprise Manager console and add the data source entry by using wizard provided by 9iAS.
    Ensure the case of the JNDI lookup string, since, it is case sensitive.
    Hope this helps.
    Abhijeet

  • HT1695 I have owner my iPad for approx six months. I have been connected to the Internet from my home thru my Wifi with no problems. Suddenly four days ago I have not been able to get my IPad to connect to my home wireless. All other computers in my home

    To follow up on my question. Only because this is the first time I am using this forum.
    I have owned the iPad for approximately six months.
    I have been using the iPad at home thru my wireless network, no problems.
    In addition to my IPad I connect to the intent with my laptop, and my cell phone. No problem.
    Suddenly approximately five days ago I have not been able to connect my IPad to the Internet. Laptop and cell phone still connect.
    However when I leave my home I am able to connect my IPad from the Public Library and from Starbucks.
    Can anyone give me some advice on how to get connected from my home.
    Not sure how or when I can expect a response to this problem.
    Thanks
    Bill
    <Email Edited by Host>

    Thanks, however I am not familiar with the Sleep and Homekey buttons on my IPad.
    What I plan to do when I get home from Starbucks is, Settings/general/Reset/reset network
    I have rebooted my router no luck.
    Am I missing something on not knowing about the Sleep and Homekey?
    Thanks,
    Bill

  • Accessing the HDD connected in the aTV from laptop

    Hi,
    Sorry if this is anwsered somewhere already, I've been looking for an answer and nothing comes up... I currently have a old Boxee Box at home and I'm thinking of replacing it with an Apple TV 3rd Gen. Right now, I'm using the Boxee Box as a NAS. I have an External HDD connected to it, and I can access the drive from the Boxee Box IP address.
    Can I do the same thing with the aTV? I would connect the external HDD to the aTV, access it from my Macbook and make my iTunes library on it,
    Thanks!

    Oh there is no USB port to it? I mean, I thought I could've plugged the HDD in one of the USB ports of the AppleTV, then access the drive with the AppleTV IP address.

  • I am unable to connect to the icloud from my windows laptop and get an error message: "Connection error: icloud encountered an error while trying to connect to the server"

    I am unable to connect to icloud from my windows-based laptop and get the following error message: "icloud encountered an error while trying to connect to the server."

    I would remove the email account from mail and then set it up again.
    If your are able to long I via owa though without the auto fill, then we already know the user name and password are correct.
    Let me know if that works.

  • How far away can you connect to the internet from Airport Extreme (802.11n)

    How far can i take my Laptop away from Airport Extreme (802.11n) and still have internet connection

    According to:
    http://www.apple.com/au/airportexpress/
    They claim the Extreme has a 45m range:
    "Suppose you want to connect to the Internet with your PowerBook in an area that lies beyond the 45 metre range of your AirPort Express or AirPort Extreme Base Station"
    Will you be using all N devices? G?, B? or a combination?

Maybe you are looking for

  • When I try to choose a new folder to save a bookmark the resulting pop-up window only shows the top lefthand quarter minus any buttons, FF4 in Ubuntu Lucid

    When bookmarking a page, I click on the star or the menu. The 'Edit This Bookmark' window appears, I click on the folder arrow and select 'Choose'. The resulting window shows a large black shadow with the top left of the actual window. If I run the c

  • Why I like Aperture

    I need to preface this by saying that no application is perfect for everyone. Different people have different workflows, different post-processing needs, and different priorities. I'm not saying Aperture is perfect for everyone. Nor should anyone els

  • CUA users in child

    Hi, I have created bunch of users in the Central system. How do I copy these users to the child systems? Please let me know. Thanks Seelan

  • WebLogic Server 7.0 is compatible with Portal4.0?

    Hi Everyone, We are planning to use WebLogic Portal4.0 for our personalized portal for our clients. As per our design and analysis, we are planning to install Portal4.0 over WebLogic Server6.1. But, as WebLogic Server 7.0 version is the most recent v

  • Synchronize Single Keystroke?

    I know that I can select multiple images, make some Develop changes and push Shift-Command S to bring up the Synchronize Window. But, then I need to either hit the Enter key, or or the Synch Button. This is an extra step I would like to avoid. Is the