LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Change Current Directory

I have a VB program in Outlook that's making calls to Excel. The user
needs to open an Excel file and there are two things I would like to
do to help things go easier.

1.) I would like to change the current directory. If the code was in
Excel, it would be a simple matter of of using the ChDrive and ChDir
functions. However, the Excel.Application object does not contain
either of those fuctions and I have not been able figure it out how to
do it.

2.) I would like to filter the files in the Open Filename dialog box.
The filename will be of the form *SearchStr*.xls*. I can set the
*.xls* file filter easily enough, but I have not been successful at
setting the *SearchStr* for the file name filter.

Here is a summary of the code I am using.

Sub File_Opener()
Dim XL As Excel.Application
Dim SearchStr, FileName As String

'*** Omit code that populates Search String based on the contents of
an open email message

Set XL = CreateObject("Excel.Application")
XL.Visible = True

'*** How Could I change the current directory in Excel?

'*** How can I set the file filter in the Open File Dialog to be of
the form *SearchStr*.xls*?
FileName = XL.GetOpenFilename("Excel Files (*.xls*), *.xls*")
If FileName = "" Then Exit Sub Else XL.Workbooks.Open FileName
End Sub
 
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
Chdir does not seem to change the current directory -- ?? plh Excel Programming 5 May 2nd 08 01:08 AM
Change current directory to the directory that the workbook loads from! alondon Excel Programming 5 April 17th 07 06:05 AM
current directory Ross[_2_] Excel Discussion (Misc queries) 1 April 2nd 07 10:00 PM
Current Directory Mallasch Excel Discussion (Misc queries) 4 September 15th 06 03:05 AM
changing current directory to that of the current open file unnameable Excel Programming 2 May 19th 04 11:14 AM


All times are GMT +1. The time now is 06:54 PM.

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"