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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBE vBproject Thisworkbook alternative in Access

Status
Not open for further replies.

Chance1234

IS-IT--Management
Jul 25, 2001
7,871
US
Have a bit of code in excel which runs fine

Dim vbProj As VBProject
Set vbProj = ThisWorkbook.VBProject

having a bit of trouble getting this working in access

where does the VBproject fit with in access ?

Chance,

Filmmaker, taken gentleman and He tan e epi tas all change on monday
 
It fits in the same way, did you add a reference to the Microsoft Visual Basic for Applications Extensibility x.x library?

CMP

(GMT-07:00) Mountain Time (US & Canada)
 
A few notes (Office 2000), as I am not sure I get your point. I tried these three, and they seem to work.
Code:
'Access Module:
strModuleName = "Module1"
DoCmd.OpenModule strModuleName
Set mdl = Modules(strModuleName)
Debug.Print strModuleName & ": " & mdl.CountOfLines
DoCmd.Close acModule, strModuleName

'Access Form:
strFormName = "Customers1"
DoCmd.OpenForm strFormName, acDesign
If Forms(strFormName).HasModule Then
    Set mdl = Forms(frmName).Module
    Debug.Print strFormName & ": " & mdl.CountOfLines
End If
DoCmd.Close acForm, strFormName
End Sub

'Excel module:
'Needs Reference to Excel Library
    Dim oApp As Excel.Application
    Set oApp = CreateObject("Excel.Application")
    oApp.Visible = True
    
    oApp.Workbooks.Open FileName:= _
        "C:\Tek-Tips\Book1.xls"
    Set vbProj = oApp.VBE.ActiveVBProject
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top