Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have this code linked with a button on an excel sheet
Sub Refresh() Workbooks("IDS Time Sheet.xls").RefreshAll End Sub The problem is that the end user will be copying this file and renamin it so that "IDS Time SHeet.xls" would end up becoming another name lik Username2-4-04.xls or something to that effect. Is there a way t achieve the same thing no matter what the workbook name would end u being? Thanks as always Jason Sel -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jason,
A worksheet has two names, the sheet name that we all know and love, and the codename. When you look at the sheet objects in the VBE explorer window, you will see something like 'Sheet1(Sheet1)'. This is the default status, when the sheet name is changed in Excel, it will look like 'Sheet1(IDS Time Sheet)'. You can also change the first, and your typical Excel user can't. To change it, select the workbook in the VBE, and change the Name property in the properties window. To use it in VBA, use Sub Refresh() Sheet1.RefreshAll End Sub -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "JasonSelf " wrote in message ... I have this code linked with a button on an excel sheet Sub Refresh() Workbooks("IDS Time Sheet.xls").RefreshAll End Sub The problem is that the end user will be copying this file and renaming it so that "IDS Time SHeet.xls" would end up becoming another name like Username2-4-04.xls or something to that effect. Is there a way to achieve the same thing no matter what the workbook name would end up being? Thanks as always Jason Self --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thisworkbook.RefreshAll
thisworkbook is a reference to the workbook containing the code. -- Regards, Tom Ogilvy "JasonSelf " wrote in message ... I have this code linked with a button on an excel sheet Sub Refresh() Workbooks("IDS Time Sheet.xls").RefreshAll End Sub The problem is that the end user will be copying this file and renaming it so that "IDS Time SHeet.xls" would end up becoming another name like Username2-4-04.xls or something to that effect. Is there a way to achieve the same thing no matter what the workbook name would end up being? Thanks as always Jason Self --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
MS Query refresh question | Excel Discussion (Misc queries) | |||
web refresh question | Excel Discussion (Misc queries) | |||
Complicated ODBC data refresh question. | Excel Discussion (Misc queries) | |||
Create refresh button in worksheet to refresh Pivot Table Data | Excel Worksheet Functions | |||
Pivot Table REFRESH Flaw -- Saves Old Data in Selection Area AFTER REFRESH | Excel Programming |