Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2006

Tip: Looking for answers? Try searching our database.

VB Script for Excel Revised Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
VB Script for Excel - 22 Mar 2006 07:55 GMT
I need to activate a workbook through a cell reference. the workook
name is stored in cell A1 as "pnlreport_060321.xls". This name
automatically changes daily based on the date. This is how I wrote the
code to activate the workbook:
Sub import()

Dim fileA As String
fileA = Range("A1").Value
windows("fileA").Activate

End Sub

However this does not seem to work. It gives me an error message
"Run-Time Error '9': Subscript Out of Range" and stops at the third
line (windows("fileA").Activate).

Please HELP. How would I activate a workbook which is already open. I
cannot use the file name in the code because the name changes every
day.

Thanks : )
Ivan F Moala - 22 Mar 2006 08:04 GMT
Try

Code
-------------------
   
 windows(fileA).Activate

-------------------

--
Ivan F Moal
VB Script for Excel - 22 Mar 2006 08:25 GMT
It doesn't work Ivan. It still gives me same error and brings the
yellow mark on that same line.
thnx
Ivan F Moala - 23 Mar 2006 04:33 GMT
Is cell A1 = "pnlreport_060321.xls" the same as your Window activat
name?

It may read "pnlreport_060321" depending on weeather your window
setting is set to display File extensions

--
Ivan F Moal
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.