I am using a collection of Workbooks that are supposed to work in sync.

When the main "System" Workbook is opened it initializes showing a sequence of userforms which get information from the user to determine how to proceed. One of the options is to "check inventory", when chosen it opens and activates the "Inventory" workbook.

I would like to have the "Inventory" workbook initialize with a userform asking the user if they would like to perform a vlookup or to adjust "quantity on hand".

I have tried to enter code in the "Inventory" workbook's "ThisWorkbook" telling it to show the userform when the workbook opens but it doesn't work when activated through the "System" workbook.

However, if I open the "Inventory" workbook outside of the main "system" workbook (by selecting it from windows file manager) it opens the way I would like it to.

This is what I have used so far

Private Sub Workbook_Open()

    Application.EnableEvents = False
    
    Call Auto_OpenInv
    
End Sub
Sub Auto_OpenInv()
    
    Application.Visible = False 'Hides application while userform is shown
    frmInventoryHome.Show vbModal
    
End Sub

Any Ideas?

Recommended Answers

All 3 Replies

This is quite confusing.

Firstly, if you say workbook, do you mean that you are using VBA in excel?

I would like to have the "Inventory" workbook initialize with a userform asking the user if they would like to perform a vlookup or to adjust "quantity on hand".

I have tried to enter code in the "Inventory" workbook's "ThisWorkbook" telling it to show the userform when the workbook opens but it doesn't work when activated through the "System" workbook.

Are these all different workbooks/applications?

Sorry!

Yes I am using vba in excel. And yes they are different workbooks in the same workbook collection within the application.

Have a look at THIS link. It covers opening, interaction and closing of workbooks outside your application.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.