Solved

Changing name of Workbooks

Posted on 2011-02-20
3
220 Views
Last Modified: 2012-05-11
Hi,
There are two workbooks that people work in each week.
I have done some VBA which is attached to a button in workbook 1.
I would like to pass some information from workbook 1 to workbook 2.
I have found some good advice on here how to do that, when the workbooks have a constant name.
My problem is that each week, "the powers that be", insist on saving the updated workbooks to include the week number. So each week the name of the workbooks change.
So workbook 1 is called for example "Plant 2 Performance Wk 5 2011", and workbook 2 is "Plant 2 Scoreboard Wk 5 2011", and each week the week number is incremented by 1 manually.

I don't mind the manual saving, (a database is being developed to replace these workbooks), but I would like to be able to open the "Plant 2 Scoreboard Wk ? 2011" from the button on Plant 2 Performance Wk ? 2011" where the week numbers match.
(both workbooks are in the same folder on a file server, and "Plant 2 Performance Wk ? 2011" is always opened and updated before "Plant 2 ScoreboardWk ? 2011" is opened.

As always any help is appreciated.
0
Comment
Question by:Stephen Byrom
  • 2
3 Comments
 
LVL 59

Accepted Solution

by:
Chris Bottomley earned 500 total points
ID: 34936749
Perhaps using the workbook name i.e.

application.workbooks.open replace(thisworkbook.FullName, "Performance", "Scoreboard",,,vbTextCompare)

Assumes the code is in the performance workbook but if not simply reference the applicable workbook

Chris
0
 
LVL 1

Author Closing Comment

by:Stephen Byrom
ID: 34936766
Brilliant !!!
You come to my rescue yet again.
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 34936798
Always a pleasure to help

Chris
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now