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

Greetings !

I get "User-defined functions undefined" errors
with these first two lines.... :(

Dim objFSo As New FileSystemObject
Dim objFolder As Folder

Set objFolder = objFSo.GetFolder(myPath)

Help !

RClay AT haswell DOT com
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Variable Types

Have you created a reference to the Microsoft Scripting Runtime in
Tools=References in the VBE.

If not, you need to to use the New syntax.

If you don't want to, then dim your variables as Object and use CreateObject
in lieu of using the New syntax and declaring your variables as specific
objects (defined in the scripting runtime library).

--
Regards,
Tom Ogilvy

"Robin Clay" wrote in message
...
Greetings !

I get "User-defined functions undefined" errors
with these first two lines.... :(

Dim objFSo As New FileSystemObject
Dim objFolder As Folder

Set objFolder = objFSo.GetFolder(myPath)

Help !

RClay AT haswell DOT com



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Variable Types


-----Original Message-----
Have you created a reference to the
Microsoft Scripting Runtime in
Tools=References in the VBE.


No... [small voice] ...I didn't know it existed...


So THAT's now fixed.... Thank you very much !

But now :(

WeCopy = False
Set TargetList = Application.FileSearch
With TargetList
.LookIn = TargetRoot & Stub
.FileName = SourceName
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) _
0 Then

'MsgBox "There were " & _
.FoundFiles.Count & " file(s) found."

'For I = 1 To .FoundFiles.Count
' MsgBox .FoundFiles(I)
'Next I
ERROR ! Text = .FoundFiles(1).Datelastmodified
If SourceDate _
.FoundFiles(1).Datelastmodified _
Then WeCopy = True

Else
'MsgBox "There were no files found."
WeCopy = True
End If
End With

If WeCopy Then
'Copy Source file to Target
Text = SourceRoot & Stub & SourceName
Text = TargetRoot & Stub & SourceName
On Error Resume Next
MkDir TargetRoot & Stub
Application.CopyFile SourceRoot & Stub & _
SourceName, TargetRoot & Stub & SourceName
On Error GoTo 0
End If



RClay AT haswell DOT com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Variable Types

foundfiles does not have a DateLastModified Property and
Application.FileSearch has no relationship to the Scripting Runtime or the
FileSystemObject.

Anyway, this is the example from the VBA filedatatime function:

Dim MyStamp
' Assume TESTFILE was last modified on February 12, 1993 at 4:35:47 PM.
' Assume English/U.S. locale settings.
MyStamp = FileDateTime("TESTFILE") ' Returns "2/12/93 4:35:47 PM".
soText = FileDateTime(.foundfiles(i)) or replace i with 1 - whatever your
intent is. orDim dText as DateDim SourceDate as DateSourceDate = Now dText
= FileDateTime(.Foundfiles(i)) if dText < SourceDate Then-- Regards,Tom
Ogilvy"Robin Clay" wrote in message
...

-----Original Message-----
Have you created a reference to the
Microsoft Scripting Runtime in
Tools=References in the VBE.


No... [small voice] ...I didn't know it existed...


So THAT's now fixed.... Thank you very much !

But now :(

WeCopy = False
Set TargetList = Application.FileSearch
With TargetList
.LookIn = TargetRoot & Stub
.FileName = SourceName
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) _
0 Then

'MsgBox "There were " & _
.FoundFiles.Count & " file(s) found."

'For I = 1 To .FoundFiles.Count
' MsgBox .FoundFiles(I)
'Next I
ERROR ! Text = .FoundFiles(1).Datelastmodified
If SourceDate _
.FoundFiles(1).Datelastmodified _
Then WeCopy = True

Else
'MsgBox "There were no files found."
WeCopy = True
End If
End With

If WeCopy Then
'Copy Source file to Target
Text = SourceRoot & Stub & SourceName
Text = TargetRoot & Stub & SourceName
On Error Resume Next
MkDir TargetRoot & Stub
Application.CopyFile SourceRoot & Stub & _
SourceName, TargetRoot & Stub & SourceName
On Error GoTo 0
End If



RClay AT haswell DOT com



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Variable Types


Thank you, Tom, very much for your help and the sample you
gave (and your patience !)

I don't really understand it at first reading, but I'll
work on it.... <grin


-----Original Message-----
foundfiles does not have a DateLastModified Property and
Application.FileSearch has no relationship to the

Scripting Runtime or the
FileSystemObject.

Anyway, this is the example from the VBA filedatatime

function:




RClay AT haswell DOT com

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
How can I hide unused file types from file types list in save dial Estra Q Excel Discussion (Misc queries) 1 December 17th 09 12:36 PM
Excel 2007 error "some chart types cannot be combined with other chart types. Select a different chart types" roadsidetree Charts and Charting in Excel 15 June 2nd 09 10:53 AM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM
Cells.Find error Object variable or With block variable not set Peter[_21_] Excel Programming 2 May 8th 04 02:15 PM
VB6 to VBA conversion. Form vs. UserForm differences. Object variable types Rick Labs Excel Programming 2 May 4th 04 11:36 PM


All times are GMT +1. The time now is 12:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"