Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General 2 / August 2004



Tip: Looking for answers? Try searching our database.

switching between workbooks

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Corey - 31 Aug 2004 03:56 GMT
Hi,

I am starting my macro off with:

dlganswer = Application.Dialogs(xlDialogOpen).Show

This allows the user to pick which file they would like to open.  My
problem, however, is trying to switch back and forth between my
workbooks.  If I knew the specific name of the workbook (if it was
always the same), I could just write:

windows("name of file").activate

But how to I do this when I don't know the name of the file they will
open?

I have tried things like:

windows.dlganswer.activate

but it doesn't work.  Put simply, is there a way to fetch the file
name?  Please keep in mind I'm a beginner.  Thanks!

Thanks!
Steve Gerrard - 31 Aug 2004 08:42 GMT
| Hi,
|
[quoted text clipped - 20 lines]
|
| Thanks!

dlganswer will return simply True or False, depending on whether the
dialog completed or was cancelled.

If it succeeds, the newly opened file will become the active workbook. I
would suggest using workbooks rather than windows to control excel.

So, if dlganswer is True, then ActiveWorkbook will be the workbook just
opened. You can retrieve its name using
   wbName = ActiveWorkbook.Name

You can later reactive it using
   Workbooks(wbName).Activate
 
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



©2009 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.