OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Thread Tools Search this Thread Display Modes
Old 26-02-2015, 22:49
ager ager is offline
Join Date: Jul 2010
Location: Russia
Posts: 44
Default References...

How to add a new reference in macro from Tools>References> (in VB-editor) using programm code?
For example, I want to use msdao15.dll from "common files\system\ado"
There is simple function in VBA-Excel:
ThisWorkbook.VBProject.References.AddFromFile "FileName"
What is corresponding function in CorelDRAW X4?
Reply With Quote
Old 26-02-2015, 23:39
shelbym's Avatar
shelbym shelbym is offline
Senior Member
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,788
Blog Entries: 12
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Late Binding

As far as I know there is not such a function. So if you do not want to add the reference you will need to use Late Binding. Here is a simple example:
Sub LateBindingExample()
    Dim objConn As Object, objRS As Object
    Set objConn = CreateObject("ADODB.Connection")
    Set objRS = CreateObject("ADODB.Recordset")
    With objConn
        .Provider = "Microsoft.Jet.OLEDB.4.0"
        .ConnectionString = "Data Source=C:\Temp\sample.MDB;"
    End With
    If objConn.State = 1 Then
        MsgBox "The connection to this database is working!", vbInformation
        MsgBox "You were unable to connect to the database!", vbInformation
    End If
    objRS.Open "Select Price FROM tblPrices", objConn
    While Not objRS.EOF
        MsgBox objRS("Price")

    Set objRS = Nothing
    Set objConn = Nothing
End Sub
Hopefully that will be helpful,

Reply With Quote
Old 27-02-2015, 00:09
ager ager is offline
Join Date: Jul 2010
Location: Russia
Posts: 44

Thank you, Shelby, for the explanation!
Late Binding works as well as adding the reference.
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fix Object References in macros JavierDiaz Macros/Add-ons 2 19-12-2005 08:32

All times are GMT -5. The time now is 08:02.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com