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 November 11th, 2003, 11:20 PM
Registered User
 
Join Date: Nov 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default URGENT: automate - OPEN A FILE DIALOG BOX,SELECT

Hi,
hope you could help me out. how do you automate the following:


First step: click a button
second step: file dialog box will be opened
3rd step: user will highlight the excel files to be selected
4th step: selected excel files will be stored in a list box. List box arranges the list in alphabetical or chronological order.
5th step: user will select the excel files from the list box (list box should allow multiple selection). Worksheet of each selected workbook will be stored in a list box. List box arranges the list in alphabetical or chronological order.
6th step: user will select the corresponding worksheets from the list box.
7th step: user will click on a button which will automatically copy the selected workbooks on one new workbook. First workbook and worksheet will be appended first. Next workbooks and worksheets will be appended next, depending on the order on the list boxes. Appending of data shall start on the next blank row after the last row that has data.


Thanks very much!!


 
Old December 13th, 2003, 05:22 PM
Authorized User
 
Join Date: Nov 2003
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use the GetOpenFileName method of the Application object from the Excel library. The following was taken directly from the Microsoft Visual Basic Help.



GetOpenFilename Method


Displays the standard Open dialog box and gets a file name from the user without actually opening any files.

Syntax

expression.GetOpenFilename(FileFilter, FilterIndex, Title, ButtonText, MultiSelect)

expression Required. An expression that returns an Application object.

FileFilter Optional Variant. A string specifying file filtering criteria.

This string consists of pairs of file filter strings followed by the MS-DOS wildcard file filter specification, with each part and each pair separated by commas. Each separate pair is listed in the Files of type drop-down list box. For example, the following string specifies two file filters—text and addin: "Text Files (*.txt),*.txt,Add-In Files (*.xla),*.xla".

To use multiple MS-DOS wildcard expressions for a single file filter type, separate the wildcard expressions with semicolons; for example, "Visual Basic Files (*.bas; *.txt),*.bas;*.txt".

If omitted, this argument defaults to "All Files (*.*),*.*".

FilterIndex Optional Variant. Specifies the index numbers of the default file filtering criteria, from 1 to the number of filters specified in FileFilter. If this argument is omitted or greater than the number of filters present, the first file filter is used.

Title Optional Variant. Specifies the title of the dialog box. If this argument is omitted, the title is "Open."

ButtonText Optional Variant. Macintosh only.

MultiSelect Optional Variant. True to allow multiple file names to be selected. False to allow only one file name to be selected. The default value is False

Remarks

This method returns the selected file name or the name entered by the user. The returned name may include a path specification. If MultiSelect is True, the return value is an array of the selected file names (even if only one file name is selected). Returns False if the user cancels the dialog box.

This method may change the current drive or folder.


I hope this helps you. This is something I've been looking for myself and just recently found it.





Similar Threads
Thread Thread Starter Forum Replies Last Post
multi select open box dialog yourfriendahsan Visual Basic 2005 Basics 1 July 19th, 2007 02:49 PM
Call windows' "Open file" dialog box from an swf vicky_barse Flash (all versions) 1 December 30th, 2005 12:47 PM
open file dialog box mh VB.NET 7 April 11th, 2005 10:15 AM
Open File Dialog Box KennethMungwira VB.NET 3 August 3rd, 2003 09:44 PM
Open File Dialog Box KennethMungwira VB.NET 2 June 27th, 2003 04:36 PM





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