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 8987205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:44:00+00:00 2026-06-15T21:44:00+00:00

Can VBA code be written to perform actions on any Excel file? When I

  • 0

Can VBA code be written to perform actions on any Excel file?

When I create a project in Visual Studio, it asks for an Excel file to be linked to it. All the code that I write is in ThisWorkbook.vb and hence acts only on the Excel file linked to the project.


Ideally, I want a script that:

  1. When the user double-clicks, he/she should be allowed to select an Excel file of choice for the actions to be performed on that file.
  2. If the above is not possible, I’d at least like to invoke the VBA script from within an Excel file.

Basically, the VBA code should be independent of any Excel file.

I looked at VBScript, but the syntax for it seems to differ slightly.

  • 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-15T21:44:01+00:00Added an answer on June 15, 2026 at 9:44 pm

    Answer 1

    You can do that in VB.Net too. Just make a regular project. (comment by @SLaks)

    This worked for me very well and was exactly what I was looking for.

    Answer 2

    The very descriptive answer posted by @ErikEidt

    I haven’t tried this, but it seems like a good and alternative way of getting macros to work.

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

Sidebar

Related Questions

I am looking to run SQL queries using VBA code in an Excel file.
I'm a complete beginner to Excel VBA. The following is code I've written that
Sorry i don't have any code written because i have never written vba in
I can successfully inject a piece of VBA code into a generated excel workbook,
Can anyone recommend an SVN client for use in Excel with VBA (code modules
Can anyone explain to me why, in VBA code for a button on a
Hidden worksheets/workbooks have some limitations to what can be done in VBA code, like
In an Excel formula you can use =ISERR(A1) or =ISERROR(A1) In a VBA macro
How can I add a DateTimePicker to a User Form using VBA code. Similar
Is there a macro, VBA code or VBScript that I can write to edit

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.