![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
|
I have a macro that opens and closes other work books so I have a statement to activate the workbook that has the macro.
Workbooks("Current.xls").Activate The thing is, this file gets saved ever now and then as a newer version, and I have to change that file name Current.xls to the new name every time I run that macro. How can I stop from having to do this? Something like ActiveWorkbook = ThisVersion Workbooks(ThisVersion).Activate Or Dim ActivateThisFile as String ActivateThisFile = ???? |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Portland, OR USA
Posts: 1,374
|
If I'm understanding you correctly, you can do something like this:
Dim wbk as Workbook Set wbk = ThisWorkbook '... your code wbk.Activate ___________________________ Hope this helps, Russell |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|