Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access VB Project from another VB project: How? 1

Status
Not open for further replies.

rvr

Programmer
Jan 26, 2000
16
ZA
Hi,<br><br>How can I access the code in a VB project (either from the form or a module) from another VB project.<br>I would like to write a program in VB that would open another VB project and extract a piece of code from the form or module in that project.&nbsp;&nbsp;Is it possible, and how do I go about it?<br><br>Thanks in advance
 
You could open the *.FRMS or *.BAS files using DriveList, DirList and FileList controls. Then:<br><br><FONT FACE=monospace><br>Private Sub File1_Click()<br>Open File1.FileName For Binary as #1<br>C$ = String$(LOF(1),32)<br>Get #1,,C$<br>Close #1<br>'Place the file in a TextBox control<br>Text1.Text = C$<br><br>End Sub<br></font><br><br>Then you can use a variety of methods to search for code, copy, paste etc. But if you want anyting fancy you will be faced with creating a full-blown word processor. It depends upon what you want to do.<br><br>A more detailed description of your intentions would be helpful.<br> <p> <br><a href=mailto: > </a><br><a href= plain black box</a><br>
 
You could do it as an add-in. If you create a new add in project from the template provided, then you should be able to find the &quot;initialise&quot; type event which fires when the addin is loaded and passes your code an object representing the VB environment.&nbsp;&nbsp;Then your project is represented by a load of objects which you can use to do what you want.<br><br>Mind you, I don't know whether or not all editions of VB can create add ins. If you can't do it that way, you might be lumbered with writing code that looks at the project file to get the paths for the module files and doing it that way.<br><br>Hope this rambling is of some help.<br>Jon <p> Jonathan<br><a href=mailto:j.w.george@virginnet.co.uk>j.w.george@virginnet.co.uk</a><br><a href= > </a><br>Working with: Visual Basic 6, Access 97, Visual Interdev 6, VBScript, Active Server Pages, SQL Server 6.5, Oracle 7
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top