Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Getting all files of a specific type in a folder

Is there any way to set (and unset) the File Type name through excel VBA?

I want to list all DWG files in a directory and make hyperlinks to them, but
the problem is that different operating systems will use different file type
names e.g. some may be "Autocad 14 Drawing" where AutoCAD version 14 is
installed while others simply "DWG File" where no AutoCAD system is
installed. It would difficult to know what the file type is named as on these
other systems.

Any ideas of a way round this?

Dylan Dawson
Scotland

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Getting all files of a specific type in a folder

No sure I follow, but does this do what you want :
Dim ACadFiles As variant

acadfiles = Application.GetOpenFilename("AutoCad File
(*.dwg;*.dwf),*.dwg;*.dwf", , "Select the AutoCad Files", , True)
if isarray(acadfile) then
'...etc

Change the file type filter to those used by AutoCad
Note this does not open the files; onlt returns an array of filename for you
do what you wish.

Or you just want the user to choose a folder and then you process the files
in that folder yourself, look at the SHBrowseForFolder API.
http://vbnet.mvps.org/code/browse/browsefolders.htm

NickHK

"DDawson" wrote in message
...
Is there any way to set (and unset) the File Type name through excel VBA?

I want to list all DWG files in a directory and make hyperlinks to them,

but
the problem is that different operating systems will use different file

type
names e.g. some may be "Autocad 14 Drawing" where AutoCAD version 14 is
installed while others simply "DWG File" where no AutoCAD system is
installed. It would difficult to know what the file type is named as on

these
other systems.

Any ideas of a way round this?

Dylan Dawson
Scotland



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Getting all files of a specific type in a folder

Nick,

I should have included code as info, the project contains a Loopfolders
Function which starts with:

Function LoopFolders(startPath As String, _
Optional filetype As String = "AutoCAD 14 Drawing", _
Optional subfolders As Boolean = True)

' Create named Ranges, for the appropriate columns in Row 8 of Worksheet
etc..

[SNIP]
And the Worksheet contains a command button with the line:

LoopFolders Range("root").Value, "Microsoft Excel Worksheet"

The worksheet is an index which automatically creates hyperlinks to the
files and I have used it for PDF files etc. where the filetype rarely varies.
But AutoCAD type files are a bugbear. Hope you can help.

Regards
Dylan
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Getting all files of a specific type in a folder

I don't see how/where you are using the filetype "AutoCAD 14 Drawing".
What are you calling with this string ?

NickHK

"DDawson" wrote in message
...
Nick,

I should have included code as info, the project contains a Loopfolders
Function which starts with:

Function LoopFolders(startPath As String, _
Optional filetype As String = "AutoCAD 14 Drawing", _
Optional subfolders As Boolean = True)

' Create named Ranges, for the appropriate columns in Row 8 of

Worksheet
etc..

[SNIP]
And the Worksheet contains a command button with the line:

LoopFolders Range("root").Value, "Microsoft Excel Worksheet"

The worksheet is an index which automatically creates hyperlinks to the
files and I have used it for PDF files etc. where the filetype rarely

varies.
But AutoCAD type files are a bugbear. Hope you can help.

Regards
Dylan



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Getting all files of a specific type in a folder

Nick,

I did it again, sorry Monday mornings.

the second part should be:

[SNIP]
And the Worksheet contains a command button with the line:

LoopFolders Range("root").Value, "AutoCAD 14 Drawing"


' Not "Microsoft Excel Worksheet" as previously denoted


The worksheet is an index which automatically creates hyperlinks to the
files and I have used it for PDF files etc. where the filetype rarely

varies.
But AutoCAD type files are a bugbear. Hope you can help.

Regards
Dylan



"NickHK" wrote:

I don't see how/where you are using the filetype "AutoCAD 14 Drawing".
What are you calling with this string ?

NickHK

"DDawson" wrote in message
...
Nick,

I should have included code as info, the project contains a Loopfolders
Function which starts with:

Function LoopFolders(startPath As String, _
Optional filetype As String = "AutoCAD 14 Drawing", _
Optional subfolders As Boolean = True)

' Create named Ranges, for the appropriate columns in Row 8 of

Worksheet
etc..

[SNIP]
And the Worksheet contains a command button with the line:

LoopFolders Range("root").Value, "Microsoft Excel Worksheet"

The worksheet is an index which automatically creates hyperlinks to the
files and I have used it for PDF files etc. where the filetype rarely

varies.
But AutoCAD type files are a bugbear. Hope you can help.

Regards
Dylan






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Getting all files of a specific type in a folder

The free "List Files" Excel add-in will list all files in a folder/subfolders
meeting a specified requirement... *.dwg for instance.
Hyperlinks are included.
Download from ... http://www.realezsites.com/bus/primitivesoftware
No registration required.
--
Jim Cone
San Francisco, USA


"DDawson"
wrote in message
Is there any way to set (and unset) the File Type name through excel VBA?

I want to list all DWG files in a directory and make hyperlinks to them, but
the problem is that different operating systems will use different file type
names e.g. some may be "Autocad 14 Drawing" where AutoCAD version 14 is
installed while others simply "DWG File" where no AutoCAD system is
installed. It would difficult to know what the file type is named as on these
other systems.
Any ideas of a way round this?
Dylan Dawson
Scotland

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Getting all files of a specific type in a folder

I can't help you yet, as I do not know why you need to use file types like
"AutoCAD 14 Drawing". I would have thought using the file extension (*.dwg)
would be sufficient. If so, see Jim's post.
If not, explain why you need to work such strings.

NickHK

"DDawson" wrote in message
...
Nick,

I did it again, sorry Monday mornings.

the second part should be:

[SNIP]
And the Worksheet contains a command button with the line:

LoopFolders Range("root").Value, "AutoCAD 14 Drawing"


' Not "Microsoft Excel Worksheet" as previously denoted


The worksheet is an index which automatically creates hyperlinks to

the
files and I have used it for PDF files etc. where the filetype rarely

varies.
But AutoCAD type files are a bugbear. Hope you can help.

Regards
Dylan



"NickHK" wrote:

I don't see how/where you are using the filetype "AutoCAD 14 Drawing".
What are you calling with this string ?

NickHK

"DDawson" wrote in message
...
Nick,

I should have included code as info, the project contains a

Loopfolders
Function which starts with:

Function LoopFolders(startPath As String, _
Optional filetype As String = "AutoCAD 14

Drawing", _
Optional subfolders As Boolean = True)

' Create named Ranges, for the appropriate columns in Row 8 of

Worksheet
etc..

[SNIP]
And the Worksheet contains a command button with the line:

LoopFolders Range("root").Value, "Microsoft Excel Worksheet"

The worksheet is an index which automatically creates hyperlinks to

the
files and I have used it for PDF files etc. where the filetype rarely

varies.
But AutoCAD type files are a bugbear. Hope you can help.

Regards
Dylan






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Getting all files of a specific type in a folder

If you need to work with File types like this, may Ivan's code can help:
http://www.xcelfiles.com/ShellFileType.html

NickHK

"DDawson" wrote in message
...
Nick,

I did it again, sorry Monday mornings.

the second part should be:

[SNIP]
And the Worksheet contains a command button with the line:

LoopFolders Range("root").Value, "AutoCAD 14 Drawing"


' Not "Microsoft Excel Worksheet" as previously denoted


The worksheet is an index which automatically creates hyperlinks to

the
files and I have used it for PDF files etc. where the filetype rarely

varies.
But AutoCAD type files are a bugbear. Hope you can help.

Regards
Dylan



"NickHK" wrote:

I don't see how/where you are using the filetype "AutoCAD 14 Drawing".
What are you calling with this string ?

NickHK

"DDawson" wrote in message
...
Nick,

I should have included code as info, the project contains a

Loopfolders
Function which starts with:

Function LoopFolders(startPath As String, _
Optional filetype As String = "AutoCAD 14

Drawing", _
Optional subfolders As Boolean = True)

' Create named Ranges, for the appropriate columns in Row 8 of

Worksheet
etc..

[SNIP]
And the Worksheet contains a command button with the line:

LoopFolders Range("root").Value, "Microsoft Excel Worksheet"

The worksheet is an index which automatically creates hyperlinks to

the
files and I have used it for PDF files etc. where the filetype rarely

varies.
But AutoCAD type files are a bugbear. Hope you can help.

Regards
Dylan






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
Pulling pdf files from general folder to specific folder [email protected] Excel Discussion (Misc queries) 2 September 8th 09 09:41 PM
Get a specific Program files folder Thierry Paradis Excel Programming 2 March 4th 06 11:56 AM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven Excel Discussion (Misc queries) 1 January 24th 06 03:28 PM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven[_2_] Excel Programming 1 January 24th 06 04:23 AM
DELETING FILES FROM A FOLDER WITH SPECIFIC EXTENSION R v Deursen Excel Programming 1 May 28th 04 02:36 PM


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