Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default refresh data vba question

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default refresh data vba question

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default refresh data vba question

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/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default refresh data vba question

That answered my question perfectly. And the other things are good t
know as well (the codename stuff per sheet)

Thanks
Jason Sel

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default refresh data vba question

I answered a completely different question , but hopefully you can squirrel
it away for another day <vbg

Bob

"JasonSelf " wrote in message
...
That answered my question perfectly. And the other things are good to
know as well (the codename stuff per sheet)

Thanks
Jason Self


---
Message posted from http://www.ExcelForum.com/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Query refresh question Dave H Excel Discussion (Misc queries) 0 May 2nd 11 04:12 PM
web refresh question teepee[_3_] Excel Discussion (Misc queries) 2 January 5th 09 02:54 PM
Complicated ODBC data refresh question. JDNETTC Excel Discussion (Misc queries) 6 January 30th 08 11:36 PM
Create refresh button in worksheet to refresh Pivot Table Data Ron Excel Worksheet Functions 1 October 13th 07 01:20 AM
Pivot Table REFRESH Flaw -- Saves Old Data in Selection Area AFTER REFRESH Ken Roberts Excel Programming 3 September 11th 03 06:02 AM


All times are GMT +1. The time now is 03:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"