Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old July 8th, 2003, 06:38 AM
Wizard2003's Avatar
Wizard2003 Wizard2003 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 206 Wizard2003 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 29 m 24 sec
Reputation Power: 6
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?

Reply With Quote
  #2  
Old July 8th, 2003, 08:23 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,834 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 23 h 30 m 30 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
use App.Path

Reply With Quote
  #3  
Old July 8th, 2003, 08:26 AM
Wizard2003's Avatar
Wizard2003 Wizard2003 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 206 Wizard2003 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 29 m 24 sec
Reputation Power: 6
Thanks ... now it works.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Me.Path Error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway