Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 21st, 2008, 07:10 AM
Authorized User
 
Join Date: May 2007
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to select an excel window?

Hi All,

I am trying to select an excel window that is presently open on my desktop. The Excel windows has a date (ddmmyy format) which is in the past the name of the file is MyExcel 140208_.xls. I wanted some help to select this window through a VBA code. I have tried coding

Windows("MyExcel " & AnyDate & "_.xls").Activate
    Sheets("MyExcel " & AnyDate & "_").Select

Anydate = Format(Date, "ddmmyy") < Date

this code is not able to activate the excel file.

please can somebody help me

Best Regards
Rohit Ghosh


 
Old March 6th, 2008, 10:24 PM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Rohit

Assuming '< Date' in Anydate = Format(Date, "ddmmyy") < Date listed here, your code is fine. It should activate the workbook.

Can you also try

Workbooks("MyExcel " & AnyDate & "_.xls").Activate

Cheers
Shasur

http://www.dotnetdud.blogspot.com

VBA Tips & Tricks (http://www.vbadud.blogspot.com)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Application Window resize detection jcable Excel VBA 2 June 4th, 2008 02:48 PM
select records from excel androoo VB How-To 1 March 22nd, 2005 06:39 AM
vb script + excel - select multiple columns mohit Excel VBA 1 January 21st, 2005 06:11 AM
Updating SELECT options list from new window VorlonKen Javascript How-To 4 February 10th, 2004 11:59 PM
Excel VBA: Select range of data and plot chart? xitu Excel VBA 1 December 23rd, 2003 04:21 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.