Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try:
ThisFolder = ActiveWorkbook.Path If the workbook has been saved, this will give the folder in which it is saved. You don't need to use ActiveWorkbook if you have a reference already to the workbook for which you wish to receive the path. There is also an Application.Path property which gives the path to where the application is run from. Are you wanting the folder of a specific workbook that you load or some other folder? Steve 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. |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The requested "the folder that the excel file that ran the macro is in" is actually
ThisWorkbook.Path -- HTH. Best wishes Harald Followup to newsgroup only please. "Steve Danielson [MS]" wrote in message ... Try: ThisFolder = ActiveWorkbook.Path If the workbook has been saved, this will give the folder in which it is saved. You don't need to use ActiveWorkbook if you have a reference already to the workbook for which you wish to receive the path. There is also an Application.Path property which gives the path to where the application is run from. Are you wanting the folder of a specific workbook that you load or some other folder? Steve 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need code to save file to new folder, erase from old folder | Excel Discussion (Misc queries) | |||
File in use Dialog box | Excel Discussion (Misc queries) | |||
Prompt user to select file with default file selected dialog | Excel Programming | |||
Prompt user to select file with default file selected dialog | Excel Programming | |||
Prompt user to select file with default file selected dialog | Excel Programming |