Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Browser window

I want to be able to force a browser window to look in a particular polder,
whenever I wish to import data.

I have tried ChDir and path commands, but am a bit stuck.

Can anybody please help?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Browser window

you don't explain why you think that it doesn't work...

Sub testfolder()
Dim fn As String
ChDrive "H"
ChDir "H:\Excel_Demos\"
fn = Application.GetOpenFilename("EXCEL(*.xls),*.xls")

End Sub

if the directory doesn't exist the function will raise an error - you will
therefore need to add an error handler



"tcbootneck" wrote:

I want to be able to force a browser window to look in a particular polder,
whenever I wish to import data.

I have tried ChDir and path commands, but am a bit stuck.

Can anybody please help?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Browser window

Thanks.

Maybe I should have given some more info.

I want to import a text file that is on a network drive and therefore wish
to use a path name as opposed to a dir name i.e \\network\folder\ and list
..txt files.

I have managed to force it to look for .txt files only, it's just the need
to point it at the right folder where the .txt files are situated.

Example of the code within X's

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Dim data_dir As String

data_dir = "\\folder\nationals\Ad_Hoc_Project_Live\Data\"
Set fs = Application.FileSearch
With fs
.LookIn = "data_dir"
.Filename = "*.txt*"
End With
Title = "Select the file to import"
strFileLoc = Application.GetOpenFilename("Text Files (*.txt), *.txt")

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

strFileLoc is publicly declared

Thanks again

"tcbootneck" wrote:

I want to be able to force a browser window to look in a particular polder,
whenever I wish to import data.

I have tried ChDir and path commands, but am a bit stuck.

Can anybody please help?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Browser window

Hi tcbootneck

You can use this

Private Declare Function SetCurrentDirectoryA Lib _
"kernel32" (ByVal lpPathName As String) As Long

Public Sub ChDirNet(szPath As String)
' Rob Bovey
Dim lReturn As Long
lReturn = SetCurrentDirectoryA(szPath)
If lReturn = 0 Then Err.Raise vbObjectError + 1, "Error setting path."
End Sub

See how I use it here
http://www.rondebruin.nl/copy3.htm#select


--
Regards Ron de Bruin
http://www.rondebruin.nl


"tcbootneck" wrote in message ...
I want to be able to force a browser window to look in a particular polder,
whenever I wish to import data.

I have tried ChDir and path commands, but am a bit stuck.

Can anybody please help?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Browser window

See Example 6 on this page
http://www.rondebruin.nl/copy3.htm#select

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ron de Bruin" wrote in message ...
Hi tcbootneck

You can use this

Private Declare Function SetCurrentDirectoryA Lib _
"kernel32" (ByVal lpPathName As String) As Long

Public Sub ChDirNet(szPath As String)
' Rob Bovey
Dim lReturn As Long
lReturn = SetCurrentDirectoryA(szPath)
If lReturn = 0 Then Err.Raise vbObjectError + 1, "Error setting path."
End Sub

See how I use it here
http://www.rondebruin.nl/copy3.htm#select


--
Regards Ron de Bruin
http://www.rondebruin.nl


"tcbootneck" wrote in message ...
I want to be able to force a browser window to look in a particular polder,
whenever I wish to import data.

I have tried ChDir and path commands, but am a bit stuck.

Can anybody please help?







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
file browser window saybut Excel Discussion (Misc queries) 1 August 15th 05 06:06 PM
open browser window at my given location ilyaskazi Excel Programming 3 June 2nd 05 02:39 PM
Opening browser window Abhay Parekh Excel Programming 1 December 4th 03 08:01 PM
Running macro in a browser window Ted Theodoropoulos Excel Programming 1 August 4th 03 08:24 PM
Close Browser window with VBA brianelson Excel Programming 1 July 12th 03 05:35 AM


All times are GMT +1. The time now is 10:19 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"