 |
|
|
|
| Author |
Message |
OfficeUser
Joined: 02 Feb 2008 Posts: 16
|
Posted: Mon Feb 04, 2008 6:27 pm Post subject: Re: dll File |
|
|
I downloaded MS Visual Basic Control Creation Edition and when I open it I
don't know where to go from there. Can you give me a jumpstart on how to use
VBCEE to get my functions (see previous post) into a DLL file and how do I
then call them from external VBA code?
Thanks!!
"Ralph" wrote in message @TK2MSFTNGP06.phx.gbl...
>
> "OfficeUser" wrote in message
> @corp.supernews.com...
>> Suppose I had the following functions all written in VBA, how do I get
> them
>> into a DLL file and how do I then call them from external VBA
>> code?
>>
>> Function MyProc1()
>> Function MyProc2(parameterA, parameterB) As Long
>> Function MyProc3(parameterC, parameterD) As String
>>
>> Thanks,
>>
>
> Did you download the tool?
>
> How far have you got?
>
> -ralph
>
>
Archived from group: microsoft>public>vb>winapi |
|
| Back to top |
|
 |
Schmidt
Joined: 04 Oct 2007 Posts: 806
|
Posted: Tue Feb 05, 2008 10:45 am Post subject: Re: dll File |
|
|
"OfficeUser" schrieb im Newsbeitrag@corp.supernews.com...
> I downloaded MS Visual Basic Control Creation Edition
> and when I open it I don't know where to go from there.
Open the IDE.
Go to and choose 'UserControl-project'
This should create an empty project named:
'Project1' - with an empty Usercontrol 'Usercontrol1' in it.
Now Right-Click into the Project-Tree-SubWindow
and choose Add > ... to add a new Class-Module.
That new added Class-Module should be named
automatically to 'Class1'.
Now rename your Project 'Project1' to e.g. 'MyProject'.
Ignore that empty UserControl named 'UserControl1',
but rename your Class 'Class1' to e.g. 'MyClass1'.
Put some test-functions into the Code-Window of MyClass1.
Save the project into a Project-Folder of your choice.
Compile your Usercontrol-Project to MyProject.ocx.
Now switch to your VBA-IDE and goto the Menu,
where you can choose 'Project-References' and
add your MyProject-Reference to your VBA-Project -
don't include the OCX over the VBA-Menu 'Components'.
Now you can declare in your VBA-CodeModule:
Public oMyClass As New MyProject.MyClass
Anywhere in your Code you should now be able
(supported by intellisense), to type oMyClass. ....
as soon as you type that, your list of functions
inside MyClass should pop up and is usable
inside VBA.
HTH
Olaf |
|
| Back to top |
|
 |
OfficeUser
Joined: 02 Feb 2008 Posts: 16
|
Posted: Thu Feb 07, 2008 2:32 am Post subject: Re: dll File |
|
|
Olaf,
Thank you many, many times over!!!
>
Can these functions be written in VBA or must they be written in VB6? Can
the code refer to Objects, Methods and Properties in the Excel model?
>
What do you mean by "Project-Folder"? Can it be any folder on a harddrive?
Can it be a folder on a server?
>
Where is this done in VBCCE? Under properties there is a compile tab but the
project can only be saved as a class with extension .cls. Under File in the
menu there is Make OCX.
How does the ocx file get registered in the Registry?
Thanks!
"Schmidt" wrote in message @TK2MSFTNGP03.phx.gbl...
>
> "OfficeUser" schrieb im Newsbeitrag
> @corp.supernews.com...
>> I downloaded MS Visual Basic Control Creation Edition
>> and when I open it I don't know where to go from there.
> Open the IDE.
> Go to and choose 'UserControl-project'
> This should create an empty project named:
> 'Project1' - with an empty Usercontrol 'Usercontrol1' in it.
> Now Right-Click into the Project-Tree-SubWindow
> and choose Add > ... to add a new Class-Module.
> That new added Class-Module should be named
> automatically to 'Class1'.
>
> Now rename your Project 'Project1' to e.g. 'MyProject'.
> Ignore that empty UserControl named 'UserControl1',
> but rename your Class 'Class1' to e.g. 'MyClass1'.
> Put some test-functions into the Code-Window of MyClass1.
>
> Save the project into a Project-Folder of your choice.
> Compile your Usercontrol-Project to MyProject.ocx.
>
> Now switch to your VBA-IDE and goto the Menu,
> where you can choose 'Project-References' and
> add your MyProject-Reference to your VBA-Project -
> don't include the OCX over the VBA-Menu 'Components'.
>
> Now you can declare in your VBA-CodeModule:
> Public oMyClass As New MyProject.MyClass
>
> Anywhere in your Code you should now be able
> (supported by intellisense), to type oMyClass. ....
> as soon as you type that, your list of functions
> inside MyClass should pop up and is usable
> inside VBA.
>
> HTH
>
> Olaf
>
> |
|
| Back to top |
|
 |
OfficeUser
Joined: 02 Feb 2008 Posts: 16
|
Posted: Thu Feb 07, 2008 2:36 am Post subject: Re: dll File |
|
|
>
What does this mean?
Thanks!
"Schmidt" wrote in message @TK2MSFTNGP03.phx.gbl...
>
> "OfficeUser" schrieb im Newsbeitrag
> @corp.supernews.com...
>> I downloaded MS Visual Basic Control Creation Edition
>> and when I open it I don't know where to go from there.
> Open the IDE.
> Go to and choose 'UserControl-project'
> This should create an empty project named:
> 'Project1' - with an empty Usercontrol 'Usercontrol1' in it.
> Now Right-Click into the Project-Tree-SubWindow
> and choose Add > ... to add a new Class-Module.
> That new added Class-Module should be named
> automatically to 'Class1'.
>
> Now rename your Project 'Project1' to e.g. 'MyProject'.
> Ignore that empty UserControl named 'UserControl1',
> but rename your Class 'Class1' to e.g. 'MyClass1'.
> Put some test-functions into the Code-Window of MyClass1.
>
> Save the project into a Project-Folder of your choice.
> Compile your Usercontrol-Project to MyProject.ocx.
>
> Now switch to your VBA-IDE and goto the Menu,
> where you can choose 'Project-References' and
> add your MyProject-Reference to your VBA-Project -
> don't include the OCX over the VBA-Menu 'Components'.
>
> Now you can declare in your VBA-CodeModule:
> Public oMyClass As New MyProject.MyClass
>
> Anywhere in your Code you should now be able
> (supported by intellisense), to type oMyClass. ....
> as soon as you type that, your list of functions
> inside MyClass should pop up and is usable
> inside VBA.
>
> HTH
>
> Olaf
>
> |
|
| Back to top |
|
 |
Schmidt
Joined: 04 Oct 2007 Posts: 806
|
Posted: Thu Feb 07, 2008 1:27 pm Post subject: Re: dll File |
|
|
"OfficeUser" schrieb im Newsbeitrag@corp.supernews.com...
> >
I can only guess, because I have only an older Office 2000
at hand (a german version) - but the menu-entry you shouldn't
use, is probably under .
Instead use and include the
Reference to your OCX into your VBA-Project this
way.
Olaf |
|
| Back to top |
|
 |
Schmidt
Joined: 04 Oct 2007 Posts: 806
|
Posted: Thu Feb 07, 2008 1:43 pm Post subject: Re: dll File |
|
|
"OfficeUser" schrieb im Newsbeitrag@corp.supernews.com...
> >
>
> Can these functions be written in VBA or must they be written in VB6? Can
> the code refer to Objects, Methods and Properties in the Excel model?
Yes, VBA-Syntax is usable inside the VB5CCE or VB6.
You can normally Copy'nPaste - of course VB6 doesn't
know "per default" all the internal XL-Objects - but you
can use these Objects inside your VB-OCX (your VB-Class)
as long as you pass the objects you want as Parameters
to the Subs and Functions of your OCX-Class.
> >
>
> What do you mean by "Project-Folder"?
> Can it be any folder on a harddrive?
> Can it be a folder on a server?
Yes, of course - it's a normal FileSystem-Folder of your
choice, nothing "virtual".
Inside this Folder should (after saving) exist three Files:
*.vbp (Project-Description)
*.ctl (the File which describes your empty UserControl1)
*.cls (the File which contains your Code-Class)
Filesaving is usually done over the Button with the
Disk-Symbol - that saves all files, which make up
your project - and this process is asking for their
names, if you do this the first time.
> >
> Where is this done in VBCCE? Under properties there
> is a compile tab but the project can only be saved as a
> class with extension .cls.
Yes, and it should create the other filetypes too, as
described above.
> Under File in the menu there is Make OCX.
Then this should be the right one.
> How does the ocx file get registered in the Registry?
Automatically after each compile on your developer-pc.
But if you deploy your solution, you will have to ensure
the registering over an appropriate Setup-Program.
Olaf |
|
| Back to top |
|
 |
OfficeUser
Joined: 02 Feb 2008 Posts: 16
|
Posted: Thu Feb 07, 2008 3:46 pm Post subject: Re: dll File |
|
|
Thanks once again, Olaf!!
"Schmidt" wrote in message $P%23f6VaIHA.1208@TK2MSFTNGP03.phx.gbl...
>
> "OfficeUser" schrieb im Newsbeitrag
> @corp.supernews.com...
>
>> >
>>
>> Can these functions be written in VBA or must they be written in VB6? Can
>> the code refer to Objects, Methods and Properties in the Excel model?
> Yes, VBA-Syntax is usable inside the VB5CCE or VB6.
> You can normally Copy'nPaste - of course VB6 doesn't
> know "per default" all the internal XL-Objects - but you
> can use these Objects inside your VB-OCX (your VB-Class)
> as long as you pass the objects you want as Parameters
> to the Subs and Functions of your OCX-Class.
>
>> >
>>
>> What do you mean by "Project-Folder"?
>> Can it be any folder on a harddrive?
>> Can it be a folder on a server?
> Yes, of course - it's a normal FileSystem-Folder of your
> choice, nothing "virtual".
> Inside this Folder should (after saving) exist three Files:
> *.vbp (Project-Description)
> *.ctl (the File which describes your empty UserControl1)
> *.cls (the File which contains your Code-Class)
>
> Filesaving is usually done over the Button with the
> Disk-Symbol - that saves all files, which make up
> your project - and this process is asking for their
> names, if you do this the first time.
>
>> >
>> Where is this done in VBCCE? Under properties there
>> is a compile tab but the project can only be saved as a
>> class with extension .cls.
> Yes, and it should create the other filetypes too, as
> described above.
>
>> Under File in the menu there is Make OCX.
> Then this should be the right one.
>
>> How does the ocx file get registered in the Registry?
> Automatically after each compile on your developer-pc.
> But if you deploy your solution, you will have to ensure
> the registering over an appropriate Setup-Program.
>
> Olaf
>
> |
|
| Back to top |
|
 |
OfficeUser
Joined: 02 Feb 2008 Posts: 16
|
Posted: Thu Feb 07, 2008 3:46 pm Post subject: Re: dll File |
|
|
And again, Thanks!!!
"Schmidt" wrote in message @TK2MSFTNGP04.phx.gbl...
>
> "OfficeUser" schrieb im Newsbeitrag
> @corp.supernews.com...
>
>> >
> I can only guess, because I have only an older Office 2000
> at hand (a german version) - but the menu-entry you shouldn't
> use, is probably under .
> Instead use and include the
> Reference to your OCX into your VBA-Project this
> way.
>
> Olaf
>
>
|
|
| Back to top |
|
 |
|
|
| Related Topics: | GetOpenFileName/Scroll deafault file in the file list into v I am using the from VB to display then "File Open" dialog box. You can also specify a default file in this dialog. Is there a way to scroll the file list in the dialog, so that this default file(name) is visible (and selected) in the fil
Closing File Handles to release locked file Hello everyone I would like to be able to close a file handle on a locked file. I have a situation where one program creates a Word document based on a template, and then passes the new document to Word for editing. However, the template is not released
How can I execute File Operations using the Windows File Tra Hi Gang, I would like to have my program use the built in Move and Copy Dialogs that are used by Windows Explorer/My Computer. Thanks in Advance, Christian Blackburn
Identify a file type and open the file Hi All, I want to write C# code to identify a file type and open the file in the associated editor. For example, text files should be identified and opened in notepad, html should be opened in internet At design time, I do not k
HOW TO find the target file name of a lnk file via an API ? Hi, I have a file "shortcut to in the startup directory How to find, via an windows API, the name of the target file ? (here "MyFile.exe") |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|