Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default GetopenFilename default path

Hello ,

I would like to know how i can give a Default Path (say c:\xxxx\yyyy\zzzz)
when using GetopenFilename. Is this possible or is there any other method to
do the same?
I'm using Excel 97

Regards,
SSR


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default GetopenFilename default path

Hi,

Sub GetOpenFileNameExample()
Dim vFilename As Variant
Dim sPath As String
sPath = "c:\windows\temp\"
ChDrive sPath
ChDir sPath
vFilename = Application.GetOpenFilename("Microsoft
Excel Files (*.xls),*.xls", , "Please select the file(s)
to open", , False)
If TypeName(vFilename) = "Boolean" Then Exit Sub
If CStr(vFilename) = "" Then Exit Sub
If Dir(CStr(vFilename)) < "" Then
MsgBox "Exists!!!"
Else
' Now do something with vfilename, like:
' Workbook.Open Filename:=vFilename
End If
End Sub


Regards,

Jan Karel Pieterse
Excel TA/MVP

-----Original Message-----
Hello ,

I would like to know how i can give a Default Path (say

c:\xxxx\yyyy\zzzz)
when using GetopenFilename. Is this possible or is there

any other method to
do the same?
I'm using Excel 97

Regards,
SSR


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default GetopenFilename default path

Srinath.. following works for me:

Sub UseFileDialogOpen()
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = False
.InitialFileName = "c:\"
.FilterIndex = 2 'excel files
.Show
If .SelectedItems.Count = 1 Then Workbooks.Open .SelectedItems(1)
End With
End Sub


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Srinath" wrote:

Hello ,

I would like to know how i can give a Default Path (say
c:\xxxx\yyyy\zzzz) when using GetopenFilename. Is this possible or is
there any other method to do the same?
I'm using Excel 97

Regards,
SSR




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default GetopenFilename default path

Hi,

But that does not work in XL97.

Regards,

Jan Karel Pieterse
Excel TA/MVP

-----Original Message-----
Srinath.. following works for me:

Sub UseFileDialogOpen()
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = False
.InitialFileName = "c:\"
.FilterIndex = 2 'excel files
.Show
If .SelectedItems.Count = 1 Then

Workbooks.Open .SelectedItems(1)
End With
End Sub


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Srinath" wrote:

Hello ,

I would like to know how i can give a Default Path (say
c:\xxxx\yyyy\zzzz) when using GetopenFilename. Is this

possible or is
there any other method to do the same?
I'm using Excel 97

Regards,
SSR




.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default GetopenFilename default path

Hi,

This does work but i have another problem. I'm using a network path similar
to \\xxnt\yy$\test\test1 If i put this as sPath it gives an Error when it
encounters Chdrive command . Any solutions for this?

Regards,
Srinath S

"Jan Karel Pieterse" wrote in message
...
Hi,

Sub GetOpenFileNameExample()
Dim vFilename As Variant
Dim sPath As String
sPath = "c:\windows\temp\"
ChDrive sPath
ChDir sPath
vFilename = Application.GetOpenFilename("Microsoft
Excel Files (*.xls),*.xls", , "Please select the file(s)
to open", , False)
If TypeName(vFilename) = "Boolean" Then Exit Sub
If CStr(vFilename) = "" Then Exit Sub
If Dir(CStr(vFilename)) < "" Then
MsgBox "Exists!!!"
Else
' Now do something with vfilename, like:
' Workbook.Open Filename:=vFilename
End If
End Sub


Regards,

Jan Karel Pieterse
Excel TA/MVP

-----Original Message-----
Hello ,

I would like to know how i can give a Default Path (say

c:\xxxx\yyyy\zzzz)
when using GetopenFilename. Is this possible or is there

any other method to
do the same?
I'm using Excel 97

Regards,
SSR


.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default GetopenFilename default path

Hi

By the way I can overcome this by Mapping the Folder to a Drive but I am
hoping for another solution if possible

Regards,
SSR
"Jan Karel Pieterse" wrote in message
...
Hi,

Sub GetOpenFileNameExample()
Dim vFilename As Variant
Dim sPath As String
sPath = "c:\windows\temp\"
ChDrive sPath
ChDir sPath
vFilename = Application.GetOpenFilename("Microsoft
Excel Files (*.xls),*.xls", , "Please select the file(s)
to open", , False)
If TypeName(vFilename) = "Boolean" Then Exit Sub
If CStr(vFilename) = "" Then Exit Sub
If Dir(CStr(vFilename)) < "" Then
MsgBox "Exists!!!"
Else
' Now do something with vfilename, like:
' Workbook.Open Filename:=vFilename
End If
End Sub


Regards,

Jan Karel Pieterse
Excel TA/MVP

-----Original Message-----
Hello ,

I would like to know how i can give a Default Path (say

c:\xxxx\yyyy\zzzz)
when using GetopenFilename. Is this possible or is there

any other method to
do the same?
I'm using Excel 97

Regards,
SSR


.



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
default path for data import BLS Excel Discussion (Misc queries) 0 March 7th 06 06:13 PM
default path for pictures Wazooli Excel Discussion (Misc queries) 0 February 28th 05 06:43 PM
GetOpenFilename - Default Folder Andy Excel Programming 3 September 19th 03 04:20 PM
specifing default folder with GetOpenFilename Brian Excel Programming 3 September 8th 03 01:55 PM
Setting default directory prior to GetOpenFilename David R[_3_] Excel Programming 2 September 2nd 03 12:35 PM


All times are GMT +1. The time now is 04:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"