Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Modules" as keyword for self-modification #823

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DecimalTurn
Copy link
Contributor

@DecimalTurn DecimalTurn commented Sep 18, 2023

I recently found this question on Stack Overflow, it shows how to import a new code module in VBA using the Modules object.

Here's a simplified snippet that illustrates how it works:

    Dim ThisModule As Module
    Set ThisModule = ThisWorkbook.Modules.Add
    ThisModule.InsertFile "C:\Users\(username)\Desktop\..."

I always thought you had to use VBComponents.Import, but turns out there is this undocumented method as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant