|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
||||
|
||||
|
Me.Path Error
Hi all,
if I try to run the following script, the error message: "Invalid use of Me keyword" occurs. Code:
Sub walk()
Dim szMyName As String
Dim szMyPath As String
Dim szActDoc As String
Dim nCount As Integer
Dim fs As Variant
Dim szIdErrors As String
'--- get the actuel file and path
szMyName = Me.Name
szMyPath = Me.Path & "\"
Set fs = Application.FileSearch
With fs
.LookIn = Me.Path
.FileName = "*.doc"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
For nCount = 1 To .FoundFiles.Count
szActDoc = .FoundFiles(nCount)
If szActDoc <> szMyPath & szMyName And _
Mid$(szActDoc, Len(szMyPath) + 1, 1) <> "~" Then
Documents.Open FileName:=szActDoc, ReadOnly:=True
szIdErrors = szIdErrors & szActDoc & vbCr & vbLf
'------------------
'handle tables here
'------------------
Documents(szActDoc).Close False
End If
Next nCount
'ActiveDocument.Content.InsertAfter szIdErrors & vbCr
Else
MsgBox "There were no files found."
End If
End With
End Sub
Does anybody know why? |
|
#2
|
||||
|
||||
|
use App.Path
|
|
#3
|
||||
|
||||
|
Thanks ... now it works.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Me.Path Error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|