Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default File folder dialog

How do I open a file/folder dialog in a macro? I would like to start the
macro then be able to point to the folder that contains my excel files?

Thanks
Mike


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 320
Default File folder dialog

MyFile=Application.GetOpenFileName
??
This doesn't open the file, but returns the full path of the file pointed to
(or False if cancel clicked). Then you open the file via
Workbooks.Open MyFile
....

Bob Umlas
Excel MVP

"Mike" wrote in message
...
How do I open a file/folder dialog in a macro? I would like to start the
macro then be able to point to the folder that contains my excel files?

Thanks
Mike




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default File folder dialog

Hi Mike,

Take a look at the Application.GetOpenFilename method and see if that does
what you need. It provides a UI for the user to browse and select files,
and then returns the file for your macro to process as desired.

For information and sample code for integrating Office with Visual Basic,
Visual C++, Internet Scripts, and other programming languages, please see
http://msdn.microsoft.com/library/te...SOfficeDev.htm. This site
contains the most up-to-date information for using developer tools for
Office integration and extensibility.

Best regards,
Steve Danielson
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? Please visit the Microsoft Security & Privacy Center
(http://www.microsoft.com/security) for the latest news on security updates.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default File folder dialog

Hi Mike,

I forgot to also mention:

Application.Dialogs(xlDialogOpen).Show

Take a look at the Application.Dialogs collection in the Visual Basic
Reference for Excel for more details on this and also
Application.GetOpenFilename.

For information and sample code for integrating Office with Visual Basic,
Visual C++, Internet Scripts, and other programming languages, please see
http://msdn.microsoft.com/library/te...SOfficeDev.htm. This site
contains the most up-to-date information for using developer tools for
Office integration and extensibility.

Best regards,
Steve Danielson
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? Please visit the Microsoft Security & Privacy Center
(http://www.microsoft.com/security) for the latest news on security updates.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default File folder dialog

Thanks for your replies.

I have
..LookIn = "C:\my excel path"
It is hard coded in. How do I get the path programatically?

Thanks
Mike





"Steve Danielson [MS]" wrote in message
...
Hi Mike,

Take a look at the Application.GetOpenFilename method and see if that does
what you need. It provides a UI for the user to browse and select files,
and then returns the file for your macro to process as desired.

For information and sample code for integrating Office with Visual Basic,
Visual C++, Internet Scripts, and other programming languages, please see
http://msdn.microsoft.com/library/te...SOfficeDev.htm. This site
contains the most up-to-date information for using developer tools for
Office integration and extensibility.

Best regards,
Steve Danielson
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no

rights.

Are you secure? Please visit the Microsoft Security & Privacy Center
(http://www.microsoft.com/security) for the latest news on security

updates.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default File folder dialog

curdir gives you the current path.

..lookin :=
is part of the FileSearch object.

--
Regards,
Tom Ogilvy

"Mike" wrote in message
...
Thanks for your replies.

I have
.LookIn = "C:\my excel path"
It is hard coded in. How do I get the path programatically?

Thanks
Mike





"Steve Danielson [MS]" wrote in message
...
Hi Mike,

Take a look at the Application.GetOpenFilename method and see if that

does
what you need. It provides a UI for the user to browse and select files,
and then returns the file for your macro to process as desired.

For information and sample code for integrating Office with Visual

Basic,
Visual C++, Internet Scripts, and other programming languages, please

see
http://msdn.microsoft.com/library/te...SOfficeDev.htm. This site
contains the most up-to-date information for using developer tools for
Office integration and extensibility.

Best regards,
Steve Danielson
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no

rights.

Are you secure? Please visit the Microsoft Security & Privacy Center
(http://www.microsoft.com/security) for the latest news on security

updates.





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default File folder dialog

That's it. Thanks.

Mike


"Tom Ogilvy" wrote in message
...
curdir gives you the current path.

.lookin :=
is part of the FileSearch object.

--
Regards,
Tom Ogilvy

"Mike" wrote in message
...
Thanks for your replies.

I have
.LookIn = "C:\my excel path"
It is hard coded in. How do I get the path programatically?

Thanks
Mike





"Steve Danielson [MS]" wrote in message
...
Hi Mike,

Take a look at the Application.GetOpenFilename method and see if that

does
what you need. It provides a UI for the user to browse and select

files,
and then returns the file for your macro to process as desired.

For information and sample code for integrating Office with Visual

Basic,
Visual C++, Internet Scripts, and other programming languages, please

see
http://msdn.microsoft.com/library/te...SOfficeDev.htm. This site
contains the most up-to-date information for using developer tools for
Office integration and extensibility.

Best regards,
Steve Danielson
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no

rights.

Are you secure? Please visit the Microsoft Security & Privacy Center
(http://www.microsoft.com/security) for the latest news on security

updates.







  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default File folder dialog

That's not it after all.

I have this
ThisFolder = CurDir()
MsgBox (ThisFolder)
and it is not giving me the folder that the excel file that ran the macro is
in?? It gives me my desktop. How do I get the current folder the file is
in?

Mike

"Mike" wrote in message
...
That's it. Thanks.

Mike


"Tom Ogilvy" wrote in message
...
curdir gives you the current path.

.lookin :=
is part of the FileSearch object.

--
Regards,
Tom Ogilvy

"Mike" wrote in message
...
Thanks for your replies.

I have
.LookIn = "C:\my excel path"
It is hard coded in. How do I get the path programatically?

Thanks
Mike





"Steve Danielson [MS]" wrote in

message
...
Hi Mike,

Take a look at the Application.GetOpenFilename method and see if

that
does
what you need. It provides a UI for the user to browse and select

files,
and then returns the file for your macro to process as desired.

For information and sample code for integrating Office with Visual

Basic,
Visual C++, Internet Scripts, and other programming languages,

please
see
http://msdn.microsoft.com/library/te...SOfficeDev.htm. This site
contains the most up-to-date information for using developer tools

for
Office integration and extensibility.

Best regards,
Steve Danielson
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no
rights.

Are you secure? Please visit the Microsoft Security & Privacy Center
(http://www.microsoft.com/security) for the latest news on security
updates.









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
Need code to save file to new folder, erase from old folder Ron M. Excel Discussion (Misc queries) 1 February 24th 06 06:02 PM
File in use Dialog box Chip Excel Discussion (Misc queries) 1 January 5th 06 05:30 PM
Prompt user to select file with default file selected dialog Bruce Cooley Excel Programming 0 September 15th 03 06:43 AM
Prompt user to select file with default file selected dialog Bob Phillips[_5_] Excel Programming 0 September 14th 03 09:22 PM
Prompt user to select file with default file selected dialog Bob Phillips[_5_] Excel Programming 0 September 14th 03 09:19 PM


All times are GMT +1. The time now is 09:38 AM.

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"