Excel-VBA Macro Connectivity to XE

I have an excel-macro which accesses data from Oracle9i database with the connection code;
Set oOraSession = CreateObject("OracleInProcServer.XOraSession")
Set oOraDatabase = oOraSession.OpenDatabase("iois", "bacc/password", 0&)
It runs smoothly with no problems. When I test the same application to my newly installed XE database, using the connection code;
Set oOraSession = CreateObject("OracleInProcServer.XOraSession")
Set oOraDatabase = oOraSession.OpenDatabase("XE.world", "bacc/password", 0&)
it didnt run and broadcasts an error msg.;
Runtime error '429'
ActiveX component can't create object
I know there's a way to solve this but how?
Arnel

Hi Arnel,
you might try the easy connect syntax, works fine for me.
Sub GetEmployees()
    ' Use OO4O
    Set objSession = CreateObject("OracleInProcServer.XOraSession")
    Set objDatabase = objSession.OpenDatabase("127.0.0.1:1521/XE", "hr/oracle1", 0)
    Sql = "select * from emp"
    Set oraDynaSet = objDatabase.DBCreateDynaset(Sql, 0)
    If oraDynaSet.RecordCount > 0 Then
        oraDynaSet.MoveFirst
        For x = 0 To oraDynaSet.Fields.Count - 1
            Cells(1, x + 1) = oraDynaSet.Fields(x).Name
            'Cells(1, x + 1).Format = Bold
        Next
        For y = 0 To oraDynaSet.RecordCount - 1
            For x = 0 To oraDynaSet.Fields.Count - 1
                Cells(y + 2, x + 1) = oraDynaSet.Fields(x).Value
            Next
            oraDynaSet.MoveNext
        Next
    End If
    Set objSession = Nothing
    Set objDatabase = Nothing
End SubRegards,
~Dietmar.

Similar Messages

  • Copying Graphs and Pie Charts generated in Analysis View to Email item using Excel VBA Macro Code

    Hi
    I am currently working on an exce VBA macro code that would help me take snapshots of the Graphs and Pie charts generated in QC for a particular application and copy the same to an email item using excel VBA macro code.
    I was able to write the code to create an email item. But I have no clue of how i can take snapshot of the graphs in Analysis View using excel VBA
    Any help would be highly appreciated.
    Thanks in Advance
    Regards
    Amit

    useramit,
    You are in the consumer end products forum.  You will also want to ask your question over at the Enterprise Business Community.
    Click the plus sign (+) next to Discussion Boards to drop down all the options for servers, networking and any other professionally related problems.
    http://h30499.www3.hp.com/

  • Powershell Variable from Excel.VBA Macro

    Hi Guys!
    I don't know if what i'm asking you is achievable.
    I've learned how to pass variables/arguments from powershell to Excel/VBA Macro but i need to do the opposite thing.
    This is an example of what  i want:
    Powershell                                                                      
                       Excel/VBA Macro
    $Input=1   ---------------------------------------------------------------->   Sub Macro(input)
    $excel.Run("Macro",$Input)                                                              
      Output=input +6
    $output (Expected 7)   <----------------------------------------------------  return Output
    I don't know how to do this can you help me please?
    A

    Ok guys those are the script.
    Macro:
    Sub CreatePWD()
    Dim PWD As String
    Dim i As Integer
    Dim Max As Integer
    Dim F1 As Worksheet
    Set F1 = ThisWorkbook.Worksheets("Foglio1")
    Max = F1.Range("A1").Value
    For i = 1 To Max
    If Int((2 * Rnd) + 1) = 1 Then
    PWD = PWD & Chr(Int((90 - 65 + 1) * Rnd + 65))
    Else
    PWD = PWD & Int((9 - 0 + 1) * Rnd + 0)
    End If
    Next i
    MsgBox PWD
    End Sub
    Powershell:
    $Excel = New-Object -ComObject excel.application
    $Excel.visible=$false
    $Version = "C:\Users\Alberto Corona\Desktop\Cartel1.xlsm"
    $WorkBook= $Excel.workbooks.open($Version)
    $WorkSheet= $WorkBook.worksheets.item(1)
    $WorkSheet.cells.item(1,1)=5
    $Excel.Run("CreatePWD")
    $WorkBook.save()
    $WorkBook.close()
    $Excel.quit()
    The result of macro is like "52UT7" i want a variable in powershell called $PWD that contain the value of the macro. 
    Hope the problem is clear now.
    Thanks
    A

  • Call Transaction from Excel VBA macro and download ALV list object results

    I have a situation that must be very common u2013 but I canu2019t find any clear information on how to get it done! 
    We frequently run SAP transactions, download the results (orders or inventory) into Excel, do some calculations and create a spreadsheet report. 
    I would like to automate this process using Excel VBA so that a macro will perform these steps:
    1. Run our custom SAP report "YSD033" that summarizes orders using the previous day as the [From Date] parameter.  (The user already has an active ECC 6 R3 session running.)   If possible, can the TC be run using a specific variant "G111BIZ" ?
    2. Download the list object that appears in an ALV grid as a table to an empty spreadsheet in the active workbook (export XXL list object)
    3. Save the resulting workbook and close Excel.
    Should the solution use u201Ccall transactionu201D or a GuiXT script?
    Any help would be much appreciated, and some sample VBA code would be great!
    Thanks.
    Glenn

    Good suggestion, but
    I get "permission denied" for   SapGuiAuto.GetScriptingEngine
    I also tried the method below, but received this RFC error message:
    User PPPPPPP  has no RFC authorization for function group SYST.
    Sub LoginCheck()
    If login = False Then
        ' Setting the necessary variables for R/3 connection
        Set objBAPICortrol = CreateObject("SAP.Functions")
        Set objConnection = objBAPICortrol.Connection
        ' Establish a connection
    If objConnection.Logon(0, False) Then
        login = True
        MsgBox "Connection Established"
        CommandButton1.Caption = "Disconnect"
    End If
    Else
        CommandButton1.Caption = "Connect 2 SAP"
        login = False
        objConnection.Logoff
        Set objConnection = Nothing
        Set objBAPICortrol = Nothing
    End If
    End Sub
    I was told that these kinds of authority open up too big of a window that can't be monitored adequately...
    I'm considering an approach like what is below if I can't convince security to grant me permissions...
        Application.Wait Now + TimeValue("00:00:01")
        SendKeys EnterKey, False
    Since blocked RFC security settings are preventing the solution from being installed, I am markgin this question as answered. 
    I will post different questions about 1. how to convince the security team that it will be safe to allow the use of RFC calls, and /or 2. how use some windows-level scripting code to run the SAP jobs.
    Thanks.
    Edited by: GlennWebster on Mar 1, 2010 4:34 PM

  • Using AppleScript to Launch Excel VBA Macro

    Using MS Office 2004 and AppleScript 1.9.3. I want to use AppleScript in MS Entourage to kick off a VBA macro in Excel. But no luck.
    To test things, I created an Excel file ("test.xls") with a one-line VBA macro named "test." It just puts up a dialog box with the message "success." I'm calling it from A.S as follows (per the AppleScript Dictionary for Excel 2004):
    tell application "Microsoft Excel"
    run VB macro "hard disk:users:xxx:desktop:test.xls!test"
    end tell
    I get two successive error messages:
    1. 'test.xls' cannot be accessed. The file may be read-only or you may be trying to access a read-only location."
    2. "Microsoft Excel got an error: "hard disk:users:xxx:desktop:test.xls!test" doesn't understand the run VB macro message."
    "test" file permissions are -rw-r--r-- and it is sitting right on the desktop.
    FWIW, I did not remove the old Office vX yet, but renamed old Excel "Microsoft ExcelOld". I read on some other site that this may cause problems.
    This has been endlessly frustrating. HELP!!??
    Steve

    Hi Steve,
    Have you tried dealing with the return value from your macro? If you are invoking the MsgBox function in your test macro, you may need to allow the return value from MsgBox to pass thru back to AS. Something like :
    set MyRetCode to run VB macro "Macintosh HD:Users:xxx:Desktop:test.xls!test"
    (Note unless you've changed the hard drive name to "hard drive", the default boot drive name will probably be "Macintosh HD". Case does matter here)
    I also suspect you'll need to have Entourage up as well in the full case of running a macro in Entourage from Excel (or the other way around). Hence, the command ActivateMicrosoftApp in the Excel dictionary may also be useful.
    Second, you can have a macro, in a startup template, in Entourage call a macro in a startup template in Excel to accomplish what you want without going into AppleScript at all. This latter, VB-only, method will require a "Reference", as it's called in VBA, to be added to the TemplateProject in Entourage that points to the Excel macro you want to fire off. The added benefit of this latter method is that you will have access to the full range of VBA commands/options, rather than the smaller dictionary available in AS.
    Ed
    PB G4   Mac OS X (10.2.x)  

  • Excel VBA Macros - Hide/UnHide Cells

    I am tyring to create macro that will hide cells depending on what data is in the cell. I am currently using this and it is working but I want to be able to use 2 or more as I have different cells that I want hidden depending on what is entered into other
    cells.
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Range("F5") = "Don't Show" Then
            Rows("8:9").EntireRow.Hidden = True
        Else
            Rows("8:9").EntireRow.Hidden = False
        End If
    End Sub
    But I also want this as well. How can I add them together?
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Range("F9") = "Don't Show" Then
            Rows("8:9").EntireRow.Hidden = True
        Else
            Rows("8:9").EntireRow.Hidden = False
        End If
    End Sub
    Thanks

    Hi ALS91,
    Since this is a forum for Office client technical issue, not for technical issue in developing. I suggest you posting this issue in Excel for Developer.
    http://social.msdn.microsoft.com/Forums/office/en-US/home?forum=exceldev
    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,
    Greta Ge
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Problem with controlling Annotations from Excel VBA

    Hi,
    I have a PDF document that has plenty of sticky notes attached to it. These sticky notes have been added by multiple authors on all pages of the document. I am trying to import the contents of these sticky notes, their author and the page number to an excel spreadsheet.  I am using Excel 2007 and Acrobat Professional 9.0.
    This is the code that I am currently using to import the sticky notes, but the problem that I am facing is that when I run the macro -
    Same sticky note contents, author and page numbers are imported multiple times
    Not all sticky notes are imported, only some of them appear in the final excel spreadsheet
    When I compare the number of sticky notes to that in the original PDF file, the number is correct. But the content is repeated content and that is the reason why only some of the sticky notes are imported.
    This is an activity that I need to do on regular basis and the number of sticky notes that I need to import to excel may range between 100 to 200. It is really difficult to do this task manually, so an excel VBA macro could prove really helpful.
    Sub ImportComments_Click()
    Dim Fpath As String
    Dim WordObj As Object
    Dim wbkOutput As Excel.Workbook
    Dim iRow As Integer
    Dim i, j, k As Integer
    Dim lRet As Long
    Dim objAcroAVDoc As New Acrobat.acroAVDoc
    Dim objAcroPDDoc As Acrobat.AcroPDDoc
    Dim numPages As Long
    Dim lAnnotscnt As Long
    Dim Subtype As String
    Dim NumComments As Long
    Dim AcroApp As Acrobat.AcroApp
    Dim objAcroPDPage As Acrobat.AcroPDPage
    Dim annot As Acrobat.AcroPDAnnot
    Sheets("Defect Log").Select
    Range("L3").Activate
    Fpath = ActiveCell.Value
    Sheets("Defect Log").Select
    Range("A1").Activate
    i = 0
    Do While (Not (IsEmpty(ActiveCell.Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 1).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 2).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 3).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 4).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 5).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 6).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 7).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 8).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 9).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 10).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 11).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 12).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 13).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 14).Value)))
    i = i + 1
    ActiveCell.Offset(1, 0).Select
    Loop
    iRow = i + 1
    Set wbkOutput = ActiveWorkbook
    lRet = objAcroAVDoc.Open(Fpath, "")
    Set objAcroPDDoc = objAcroAVDoc.GetPDDoc
    numPages = objAcroPDDoc.GetNumPages()
    Set objAcroPDPage = objAcroPDDoc.AcquirePage(0)
    For k = 1 To numPages
    lAnnotscnt = objAcroPDPage.GetNumAnnots()
    For m = 0 To lAnnotscnt - 1
    If lAnnotscnt = 0 Then Exit For
    Set objAcroPDAnnot = objAcroPDPage.GetAnnot(m)
    If (objAcroPDAnnot.GetContents <> "" And objAcroPDAnnot.GetSubtype = "Text") Then
    Cells(iRow, 5).Value = k
    Cells(iRow, 2).Value = objAcroPDAnnot.GetContents()
    Cells(iRow, 11).Value = objAcroPDAnnot.GetTitle()
    iRow = iRow + 1
    End If
    Next m
    Set objAcroPDPage = objAcroPDDoc.AcquirePage(k)
    Next k
    lRet = objAcroAVDoc.Close(1)
    Set objAcroAVDoc = Nothing
    Set objAcroPDAnnot = Nothing
    Set objAcroPDPage = Nothing
    Set objAcroPDDoc = Nothing
    End Sub

    Make sure you are current with 9.x patches, just on general principles.
    The code seems fine – nothing jumping out at me.
    You can also look at using the JSObject methods and trying this via the JavaScript stuff – that will give you more access to the Annotation information…
    From: Adobe Forums <[email protected]<mailto:[email protected]>>
    Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Date: Thu, 24 Nov 2011 04:25:12 -0800
    To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
    Subject: Problem with controlling Annotations from Excel VBA
    Problem with controlling Annotations from Excel VBA
    created by apreeti<http://forums.adobe.com/people/apreeti> in Acrobat SDK - View the full discussion<http://forums.adobe.com/message/4044740#4044740

  • How to use loop in VBAK table using BDC RFC connection through excel vba ?

    Hello,
    I am trying to extract data from VBAK table using rfc connection with Excel VBA. where i can able to pull data first time, when i tried to use the same set of code using loops, it throws an error like BAD INDEX.
    Any help appreciated.

    Hello,
    I am trying to extract data from VBAK table using rfc connection with Excel VBA. where i can able to pull data first time, when i tried to use the same set of code using loops, it throws an error like BAD INDEX.
    Any help appreciated.

  • Business Objects Financial Consolidation - Excel Link and VBA Macros

    Hi
    We use the excel links of Business Objects Financial Consolidation V10.5 to import and export data to/from BOF and excel
    We used VBA macros for the imports but do not know what VBA code is required to export - this code would include the package identifier that has to be selected in the window "Select item Package "
    Can anyone help?

    Hello Chrisitne,
    I am as well intersted by the same funtiont, did you find any answer?
    Can I also ask you the VBA code for Import and Export if you have it?
    Thank for your help!

  • I am mac user and want to create Object in VBA macro. when i write "set objwrd=createObject("Word.Application")"- it returns "runtime error "492" can't create object". now what it alternative to create object for word in excel macro???

    I am mac user and want to create Object in VBA macro. when i write "set objwrd=createObject("Word.Application")"… it returns "runtime error "492" can't create object". now what it alternative to create object for word in excel macro???

    Any help here...
    http://support.microsoft.com/kb/288117
    http://www.macworld.com/article/1154785/welcomebackvisualbasic.html

  • How to populate internal table( varaible of ABAP table type) in Excel VBA?

    Hi,
    I am trying to update a database table from excel using a VBA Macro.
    I am able to connect to SAP and able to read data from SAP using a RFC. Similarly after updating certain values, i want to update a table in SAP.
    Below are the steps I am doing  apart from basic settings.
    Getting the reference of the SAP TABLE type from RFC fucntion module
    ' Call RFC
    Set MyFunc = R3.Add("UPDATE_TVARVC_VIA_RFC")
    ' Get reference and Values TVARVC
    Set oParam4 = MyFunc.Tables("TVARVC")   
       2. Loop over the active cells and populate oParam4
              " add values as below
        oParam4.Rows.Add
        oParam4.Value(1, "NAME") = ..................
        oParam4.Value(1, "TYPE") = ..................
        oParam4.Value(1, "NUMB") = ..................
      Do it for all columns in the table line.
    My query is how to identify active cells and make the above code dynamic in step 2.
    Thanks in Advance,
    Best,
    Aneel

    Hi Aneel,
    You can try the following:
    e.g.
    for j = 1 to ActiveCell.SpecialCells(11).Column
      oParam4.Rows.Add
      if j=1 then oParam4.Value(j, "NAME") = ActiveSheet.Cells(1,j).Value
      if j=2 then oParam4.Value(j, "TYPE")  = ActiveSheet.Cells(1,j).Value
      if j=3 then oParam4.Value(j, "NUMB") = ActiveSheet.Cells(1,j).Value
    next j
    Regards,
    ScriptMan

  • Excel VBA to access sharepoint list without permission

    Hi,
    I do find solution to retrieve the SharePoint list from excel VBA but my problem now is on the SharePoint permission to the list.
    I am developing this solution in excel because i don't want the particular user to access the list direct from the portal because the list contains some unique and confidential data. So what i did was created a new view in the portal with selected column
    and i connect to the view from excel. So every time the user want to retrieve the data, he can run macro to refresh the data in the excel.
    When i run the macro it can generate the list because i do have permission but if i run the same macro on the person machine, excel request for username and password because he don't have the permission to the list.
    Are there any work around to allow the user to generate the data in excel without permission to the SharePoint list.
    Thanks for the help.

    I've done this before using SQL Server Reporting Services integrated into SharePoint.
    Using SSRS, create the report you want the end user to view. Then create a Report Subscription, emailing the end user (or putting it in a file share/Doc Lib) the report. If they want to run it interactively, you can enable caching on the report, which would
    pull the report from the last time it was scheduled to run (the data would not be 'real time' in this case).
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • HypRetrieve returns -3  Excel VBA

    I've written some VBA code to run a macro inside my Excel 2007 worksheet. I'm using Hyperion Smart View version 9.3.1.2.029. Here's the code I created to refresh my worksheet:
    Sub refreshData()
    'FileSystem.FileCopy "C:\ExpenseFcstDownload\Expense_Forecasting.txt", "C:\ExpenseFcstDownload\Expense_Forecasting_Previous.txt"
    'Application.ScreenUpdating = False
    Dim costCenterRowStart As Integer
    Dim costCenterColStart As Integer
    Dim costCenterCell As range
    Dim forecastRowStart As Integer
    Dim forecastColStart As Integer
    Dim forecastCell As range
    Dim fileName As String
    Dim delimiter As String
    Dim append As Boolean
    Dim rollup As String
    Dim i As Integer
    costCenterRowStart = 2
    costCenterColStart = 1
    forecastRowStart = 6
    forecastColStart = 1
    fileName = "c:\Expense_Forecasting.txt"
    delimiter = "|"
    append = False
    i = 0
    Set costCenterCell = getCell(costCenterRowStart, costCenterColStart, Sheet4)
    Set forecastCell = getCell(forecastRowStart, forecastColStart, Sheet2)
    connect
    While costCenterCell.Offset(i, 0) <> ""
    range(forecastCell, forecastCell.End(xlDown)).Clear
    'Sheet4.Select 'Cost Center Sheet
    costCenterCell.Offset(i, 0).Copy
    'Sheet2.Select 'Forecast Sheet
    'forecastCell.Offset(0, 1).Select
    range(forecastCell.Offset(0, 1), forecastCell.Offset(0, 1).End(xlDown)).Offset(0, -1).PasteSpecial (xlPasteValues)
    'Range(forecastCell.Offset(0, 1).Address, forecastCell.Offset(0, 1).Address.End(xlDown)).Select
    'Range(forecastCell.Offset(0, 1), forecastCell.Offset(0, 1).End(xlDown)).Offset(0, -1).PasteSpecial (xlPasteValues)
    forecastCell.Offset(0, 7).Formula = "=VLOOKUP(TRIM(B6),'ACCOUNT MAPPING'!$A$5:$B$291,2,FALSE)"
    forecastCell.Offset(0, 7).Copy
    ' forecastCell.Select
    range(forecastCell, forecastCell.End(xlDown)).Offset(0, 7).PasteSpecial (xlPasteFormulas)
    'Application.Wait Time + TimeSerial(0, 0, 30)
    'do the refresh
    While Len(forecastCell) = 12
    retrieve
    Set forecastCell = getCell(forecastRowStart, forecastColStart, Sheet2)
    Wend
    'Application.Wait Time + TimeSerial(0, 0, 30)
    Set forecastCell = getCell(forecastRowStart, forecastColStart, Sheet2)
    forecastCell.Offset(0, 7).Formula = "=VLOOKUP(TRIM(B6),'ACCOUNT MAPPING'!$A$5:$B$291,2,FALSE)"
    forecastCell.Offset(0, 7).Copy
    ' forecastCell.Select
    range(forecastCell, forecastCell.End(xlDown)).Offset(0, 7).PasteSpecial (xlPasteFormulas)
    'Sheet2.Select
    'forecastCell.Select
    'range(forecastCell, forecastCell.End(xlToRight)).Select
    'range(forecastCell, forecastCell.End(xlDown)).Select
    'export to txt
    append = i
    exportText forecastCell, fileName, delimiter, append
    'forecastCell.Offset(0, 7).Select
    range(forecastCell.Offset(0, 7), forecastCell.End(xlDown)).Offset(0, 7).Clear
    'forecastCell.Select
    range(forecastCell, forecastCell.End(xlDown)).Clear
    i = i + 1
    Wend
    disconnect
    Application.ScreenUpdating = True
    Workbooks(1).Save
    'FileSystem.FileCopy "C:\ExpenseFcstDownload\Expense_Forecasting.txt", "P:\Expense\Load_Data\Expense_Forecasting.txt"
    Application.Quit
    Public Sub connect()
    Dim x As Long
    x = HypConnect("Forecast Data", "user1", "1234", "EssbaseSpendExpense")
    End Sub
    Public Sub disconnect()
    Dim x As Long
    x = HypDisconnect("Forecast Data", True)
    End Sub
    Public Sub retrieve()
    Dim x As Long
    x = HypRetrieve("Forecast Data")
    End Sub
    If I step through my code (F8), it works fine. If I try to run the macro by itself (F5), the HypRetrieve will randomly return -3. I've noticed that it seems to fail more often when I'm multitasking. If I keep the spreadsheet focused and don't move the mouse, it will sometimes work. I couldn't find any error description for -3 except that it's a local failure. I know others have gotten this type of error but I couldn't find out how they resolved it.
    Thanks.

    Just a guess but make sure the active sheet is the one where you want to perform the retrieve.
    Even though the first parameter is for sheet name, currently the VBA macros ignore that setting and default to the active sheet. Sheetname is a placeholder parameter for future use.

  • Excel-2007 cannot connect to Oracle ODBC data source, Control Panel can.

    <p>
    I cannot make an ODBC connection from Exce-2007 to Oracle work. I am an expert Excel and VBA user (since 1994) and I have frequently used Excel to access ODBC databases, including Oracle (I have done this with Excel-2003 both with worksheet queries and have written VBA ADO-connection routines). And even though in Excel-2007 a worksheet ODBC query is supposed to be easier to create than in previous version of Excel, my connection fails. Any suggestions and all help are welcome and much appreciated.
    DETAILS
    </p>
    <p>
    1) <strong>What is my system?</strong> I am using Excel-2007 on Windows Vista x64 and Oracle server v.11g on my computer (all this is on my computer, no network issues).
    2)<strong> Why use Excel with Oracle at all?</strong> I use Excel-2007 to access Oracle rather than Access-2007 (or any other application like TOAD, etc.) because I do engineering calculations with the data stored in Oracle. These calculations are easier done in Excel (I suppose that one alternative to this could be to use some sql or Access to get the data from the database, then store it as plain vanilla CSV file, then open this file in Excel, then do the math (the math involves complex optimisation algorithms), then save the results as CSV, then use some sql or Access to put the data back into the database. Howwever this does not strike me as a quick or neat solution. And after all Excel has been designed to access ODBC databases, so why not use it?)
    3) <strong>What do I do in Excel-2007 that won't work?</strong> I create an ODBC link to Oracle that does not work. In Excel-2007 this is straightforward:
    </p>
    <ul>
         <li>define an ODBC connection (Data tab --&gt; From other sources --&gt; From data connection wizard);</li>
         <li>define a query on the worksheet -- that's it, this is all!</li>
    </ul>
    <p>
    I start with creating an ODBC connection:
    a) I choose an ODBC data source type: <strong><em>ODBC DSN</em></strong>
    b) Excel-2007 displays the list of the available ODBC data sources. I see in it <strong><em>my Oracle database name</em></strong> and I select it.
    c) Excel-2007 displays the Data Link Properties:
    - the "Provider" has a list of the OLE DB drivers with preselected "<strong><em>Microsoft OLE DB Provider for ODBC Drivers</em></strong>". I keep this default selection.
    - the "Connection" tab has a connection string "<strong><em>DSN=&lt;my database name&gt;</em></strong>" which I keep, it also has fields for the <strong><em>user name</em></strong> and the <strong><em>password</em></strong>, which I fill with the correct credentials.
    - Finally there is a button "Test Connection", which when I click produces the following error message:
    <strong><font color="#ff0000">"Test connection failed because of an error in initializing provider.</font></strong><strong><br />
    </strong><strong><font color="#ff0000">Unespecified error"</font></strong><strong>
    </strong>
    4) <strong>Additional food for thought:</strong>
    a) In the above walk-through the only data, which I type, are the user name and password, everything else is selected from lists offered by Excel-2007, hence any possibility of typos being the cause of the problem can safely be discarded.
    b) I can test the ODBC driver in the Control Panel and it shows that it can connect to the Oracle database:
    - in <strong><em>Control Panel --&gt; Admin Tools --&gt; Data Sources (ODBC)</em></strong> on the "User DSN" tab I can see the list of the available ODBC data sources (same list as in Excel-2007, point 3b above) with the name of my database in it;
    - selecting the name of my database from the list of the sources and clicking "Configure" button opens a tab with <strong><em>Data Source Name</em></strong> (same as in Excel-2007), TNS Service Name and User ID. I enter <strong><em>&lt;user name&gt;/&lt;password&gt;</em></strong> and click "Test Connection" button. A message "<strong><em>Connection successful</em></strong>" appears (just for a test I enter <u>incorrect user credentials</u> and "<strong><em>Unable to connect</em></strong>" message appears)
    BOTTOM LINE
    </p>
    <p>
    The procedure for using an ODBC connection from Excel is very simple, in the past I have created and used such connections numerous times with Excel-2003 and earlier on Win-XP and earlier. But now on Excel-2007 and Vista-x64 I cannot make it work.
    Also, testing an ODBC connection driver is really easy and simple to be done in the Control Panel. There testing the same ODBC connection, which fails in Excel-2007, results in success.
    I am frustrated by the simplicity of the problem and yet the persistant error. I have lost now two full days in failed attempts to make the simple procedure work and in searching the internet for answers.
    All help is highly appreciated <img class="emoticon" src="images/emoticons/happy.gif" border="0" alt="" width="16" height="16" />,
    Plamen
    </p>

    Did you find the solution to your problem?
    If not, I think I may know.
    Excel 2007 is a 32-bit application.
    When installing 32-bit applications in a 64-bit environment, the "default" location is:
    C:\Program files (x86)\...
    Excel then launches from this location.
    However, when it connects to Oracle and passes the name of the calling program, Oracle attempts to "interpret" the value of (x86) as if
    the value within the parenthesis are being passed as a reference. Of course, iOracle doesn't find anything, so the result is (),
    and then it cannot return the connection info back to the calling application.
    I corrected it by installing Excel in C:\Program Files\, and once launched from that location, it works the same as on the 32-bit machines.
    However, at my location, they are FORCING Excel to be installed in the(x86) location.
    What I'm trying to discover now is:
    Is it possible to flag Oracle to NOT process the embedded variables?
    Or, is it possible to assign a variable in Oracle such that x86 = "(x86)", so that the end result is viable?
    Have you had any luck with your installation?
    thanks,
    Paul

  • Excel 2013 macro to save pptx as pdf; error in code?

    Hello MSDN community,
    I know that this question probably was asked x1000 times, but i've been struggling for the past 6 hours to covert pptx to pdf via excel vba (this is required for my report generator, and in order to keep layout clean ad tidy i've decided to use PowerPoint,
    because Word constantly mess things up).
    Here's the code im using:
    Dim ppt As Object
    On Error Resume Next
    Set ppt = GetObject(, "PowerPoint.Application")
    If ppt Is Nothing Then
    Set ppt = CreateObject("PowerPoint.Application")
    End If
    On Error GoTo 0
    Set WDReport = ppt.Presentations.Open("C:\Users\User1\Documents\Folder\Final Report Template.pptx")
    WDReport.UpdateLinks
    Dim FileName2 As String
    FileName2 = "C:\Users\User1\Documents\Folder\Complete Report\" & Sheet14.Range("Q3").Text & " No " & Sheet14.Range("U21").Text & " Report" & Sheet17.Range("E10").Text & ".pdf"
    WDReport.ExportAsFixedFormat FileName2, ppFixedFormatTypePDF, ppFixedFormatIntentScreen
    WDReport.Close
    ppt.Quit
    Set ppt = Nothing
    Set WDReport = Nothing
    But right after PPT file opens and updates links, i receive an error message "13 Type Mismatch" on the line WDReport.ExportAsFixedFormat
    FileName2, ppFixedFormatTypePDF, ppFixedFormatIntentScreen. I've tried to replace WDReport with ActivePresentation, but received and error "429 ActiveX Component Cant Create Object".
    Here's the list of Libraries activated:
    Visual Basic for Applications
    Microsoft Excel 15.0 Object Library
    Microsoft Word 15.0 Object Library
    Microsoft PowerPoint 15.0 Object Library
    OLE Automation
    Microsoft Office 15.0 Object Library
    Additional info:
    1. When initially i was converting .docx to pdf via excel vba, everything worked out fine (well except for the format, ofcourse).
    2. I've tried to change
    FileName2 to FileName2
    = "C:\Users\User1\Documents\Folder\Complete Report\Report.pdf", but without any success.
    3. Ranges used in FileName2 use the following variable data:
    Range("Q3") is Name (e.g. Test Company)
    Range("U21") is Number (e.g. 1234567891011)
    Range("E10") is Date (e.g. Feb-15)
    So the final file name would be like "Test Company No 1234567891011 Report Feb-15.pdf".
    Once again, it worked fine when i was converting .docx to pdf 
    4. I've run this part of macro directly from PowerPoint, and it worked out fine.
    Dim FileName2 As String
    FileName2 = "C:\Users\User1\Documents\Folder\Complete Report\Report.pdf"
    ActivePresentation.ExportAsFixedFormat FileName2, ppFixedFormatTypePDF, ppFixedFormatIntentScreen, msoFalse
    So i guess there might be a problem with my Excel-PowerPoint commands execution?
    I'd really appreciate if anyone could help me with this issue. Thanks in advance!

    Hello MSDN community,
    I know that this question probably was asked x1000 times, but i've been struggling for the past 6 hours to covert pptx to pdf via excel vba (this is required for my report generator, and in order to keep layout clean ad tidy i've decided to use PowerPoint,
    because Word constantly mess things up).
    Here's the code im using:
    Dim ppt As Object
    On Error Resume Next
    Set ppt = GetObject(, "PowerPoint.Application")
    If ppt Is Nothing Then
    Set ppt = CreateObject("PowerPoint.Application")
    End If
    On Error GoTo 0
    Set WDReport = ppt.Presentations.Open("C:\Users\User1\Documents\Folder\Final Report Template.pptx")
    WDReport.UpdateLinks
    Dim FileName2 As String
    FileName2 = "C:\Users\User1\Documents\Folder\Complete Report\" & Sheet14.Range("Q3").Text & " No " & Sheet14.Range("U21").Text & " Report" & Sheet17.Range("E10").Text & ".pdf"
    WDReport.ExportAsFixedFormat FileName2, ppFixedFormatTypePDF, ppFixedFormatIntentScreen
    WDReport.Close
    ppt.Quit
    Set ppt = Nothing
    Set WDReport = Nothing
    But right after PPT files opens and updates links, i receive an error message "13 Type Mismatch" on the line WDReport.ExportAsFixedFormat
    FileName2, ppFixedFormatTypePDF, ppFixedFormatIntentScreen. I've tried to replace WDReport with ActivePresentation, but received and error "429 ActiveX Component Cant Create Object".
    Here's the list of Libraries activated:
    Visual Basic for Applications
    Microsoft Excel 15.0 Object Library
    Microsoft Word 15.0 Object Library
    Microsoft PowerPoint 15.0 Object Library
    OLE Automation
    Microsoft Office 15.0 Object Library
    Additional info:
    1. When initially i was converting .docx to pdf via excel vba, everything worked out fine (well except for the format, ofcourse).
    2. I've tried to change
    FileName2 to FileName2
    = "C:\Users\User1\Documents\Folder\Complete Report\Report.pdf", but without any success.
    3. I've run this part of macro directly from PowerPoint, and it worked out fine
    Dim FileName2 As String
    FileName2 = "C:\Users\User1\Documents\Folder\Complete Report\Report.pdf"
    ActivePresentation.ExportAsFixedFormat FileName2, ppFixedFormatTypePDF, ppFixedFormatIntentScreen, msoFalse
    So i guess there might be a problem with my Excel-PowerPoint commands execution?
    I'd really appreciate if anyone could help me with this issue. Thanks in advance!
    This undoubtedly has to do with the  FileName2 string, something must be incorrect with concatenation. As a test, in the VBA sub in Excel have the following
    FileName2 = "C:\Users\User1\Documents\Folder\Complete Report\Report.pdf"
    , I bet you the code would work :)

Maybe you are looking for