×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Using VBA routines in different files

Using VBA routines in different files

Using VBA routines in different files

(OP)
I have set up a spreadsheet that contains legacy data used on a daily basis. I have another spreadsheet that is completed for each job and stored. I want to create a routine in the job specific file that will call(start) a routine in the legacy spreadsheet(file). Is this possible and if so how?
Thanks in advance for any help.

RE: Using VBA routines in different files

Create a template from the legacy file and save it in the XLStart directory.  Any macros in the template will be available from any open spreadsheet.

See Excel help for specifics.

RE: Using VBA routines in different files

Can add a reference in the job specific file (from VBasic editor) to the open legacy file. Can then easily refer to macros written in the legacy file.

RE: Using VBA routines in different files

Mutt is right... just thought I'd give you a example to help...

Dim rngLegacyBook as Range
Set rngLegacyBook = Workbook("My Legacy Workbook").Worksheets("Sheet1").Range("A1")

After the Set statement is executed, you can refer to the Range object simply as rngLegacyBook.

For example, you can assign a value to A1 in the legacy workbook with:
rngLegacyBook.Value = 10

Have a great day!

Scott

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources