how to open the all files in a certain folder in vba.

how to open the all files in a certain folder in vba.

Anonymous
Not applicable
1,010 Views
4 Replies
Message 1 of 5

how to open the all files in a certain folder in vba.

Anonymous
Not applicable
 
0 Likes
1,011 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Using the Scripting runtime(scrrun.dll):

Option Explicit
Option Compare Text

Dim intSDI As Integer
Dim objFSO As Scripting.FileSystemObject
Dim objFolder As Scripting.Folder
Dim objFile As Scripting.File
intSDI = ThisDrawing.GetVariable("SDI")
ThisDrawing.SetVariable "SDI", 0
Set objFSO = New Scripting.FileSystemObject
Set objFolder = objFSO.GetFolder("YOUR PATH")
For Each objFile In objFolder.Files
If objFile.Name Like "*.dwg" = True Then
Application.Documents.Open "YOUR PATH" & objFile.Name

ThisDrawing.Save
ThisDrawing.Close
Next objFile
ThisDrawing.SetVariable "SDI", intSDI

Regards - Nathan
0 Likes
Message 3 of 5

Anonymous
Not applicable
THANKS FOR YOUR ADVICE.

 

but it is beyond my ken , what is
Scripting.FileSystemObject .

 

i am very sorry,for i am new to
vba.

 

thank you after all.

 

regards
0 Likes
Message 4 of 5

Anonymous
Not applicable

if you're in vba go to tools|references

 

set a reference to Microsoft Scripting
Runtime

 

the filesystemobject is one of the objects
available in that reference

go to objectbrowser to see what
objects, methods and properties are available


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

THANKS FOR YOUR ADVICE.

 

but it is beyond my ken , what is
Scripting.FileSystemObject .

 

i am very sorry,for i am new to
vba.

 

thank you after all.

 


size=2>regards
0 Likes
Message 5 of 5

Anonymous
Not applicable
THANKS FOR YOUR ADVICE.

i got it.thanks

regards


style="BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
"Mark Propst" <mark-at-atreng-dot-com> wrote in message
href="news:[email protected]">news:FA82B7F87A3E1D387F9F93F435D...
...


if you're in vba go to tools|references

 

set a reference to Microsoft Scripting
Runtime

 

the filesystemobject is one of the objects
available in that reference

go to objectbrowser to see what
objects, methods and properties are available


style="BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">

THANKS FOR YOUR ADVICE.

 

but it is beyond my ken , what is
Scripting.FileSystemObject .

 

i am very sorry,for i am new to
vba.

 

thank you after all.

 


size=2>regards
0 Likes