Solved

Changing name of Workbooks

Posted on 2011-02-20
3
225 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

679 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