Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8007783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:56:19+00:00 2026-06-04T17:56:19+00:00

Does someone know how to write VBA code in outside file, which is imported

  • 0

Does someone know how to write VBA code in outside file, which is “imported” into Excel 2003 VBA macro every time you run this macro in Excel – like self updating code?

The idea is I write code in outside editor (VIm), and every time I start Excel macro, macro checks for newer data, import that code inside if necessary and then run it (may be one or more functions/subs).

The steps are: open Excel, open XLS file, click on the button, the macro starts, checks for newer outside data (code I have written in outside editor), if data is new, delete old code, import outside code and then actually run macro itself.

Anyone?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T17:56:21+00:00Added an answer on June 4, 2026 at 5:56 pm

    Found solution (partly from http://www.cpearson.com/excel/vbe.aspx) 10x Scott:

    Sub AddOutsideCode()
        Dim VBProjekt As VBIDE.VBProject
        Dim VBKomponenta As VBIDE.VBComponent
        Set VBProjekt = ThisWorkbook.VBProject
        Call DeleteAllButThis(ThisWorkbook, "Fixed")
        Set VBKomponenta = VBProjekt.VBComponents.Import(Filename:="C:\bat\bat.bas")
        VBKomponenta.Name = "OutsideCode"
    End Sub
    
    'Delete all modules but named
    Private Sub DeleteAllButThis(ByVal wb As Workbook, ByVal CompName As String)
        Application.DisplayAlerts = False
        On Error Resume Next
        For Each komponenta In ThisWorkbook.VBProject.VBComponents
            If komponenta.Name <> CompName Then
                If komponenta.Type = vbext_ct_StdModule Then
                    ThisWorkbook.VBProject.VBComponents.Remove komponenta
                End If
            End If
        Next komponenta
        On Error GoTo 0
        Application.DisplayAlerts = True
    End Sub
    

    But how to check if the outside code changed or not?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does someone know how to write a program in C with the verbose option
I don't really know much about excel especially VBA. But i need to write
Does someone know how I can export a gridview in ASP.net to Excel?? I
does someone know how to add Umlauts to a regular expression to validate the
Does someone know how we can use permissions with Facebook C# SDK ? I
does someone know how to draw 3D surfaces and hide the invisible lines? I
Does someone know of a Sqlite manager that I can put on my site,
Does someone know or have an idea of how to reload the contents of
Does someone know why this is not a strict quine ? _0='_0=%r;print _0%%_0';print _0%_0
In jQuery ajax function there is xhr option. Does someone know more details, usability

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.