Filename with wildcard

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
tfloyd
Newbie
Posts: 5
Joined: Mon Aug 28, 2006 9:53 pm

Filename with wildcard

Post by tfloyd » Mon Sep 04, 2006 8:41 pm

How can I get a changing filename to email that file daily.
this is the line in the VBscrtipt.

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.Getfile("C:\WINNT\fontstore\Logs\*.zzr")

I know this object does not allow for wildcards. Anyway around that?


I was able to capture the filename with the MacroScheduler script but can't pass that to the VBscript.

GetFileList>C:\WINNT\fontstore\Logs\Travis*.ZZR,logfile1

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Sep 04, 2006 9:21 pm

Why can't you pass the filename to the VBScript?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

tfloyd
Newbie
Posts: 5
Joined: Mon Aug 28, 2006 9:53 pm

Post by tfloyd » Tue Sep 05, 2006 2:10 pm

Ok, how do I send the Logfile1 MAcro Scheduler variable to the VB script to be assigned to sattachment. When I try

sAttachment = logfile1

I get the error "you must provide a file path"

I edited the code for the important segments.

>>

GetFileList>C:\WINNT\fontstore\Logs\Travis*.ZZR,logfile1

VBSTART

sAttachment = "C:\logfile.zzr"

Set AttachME = doc.CreateRichTextItem("Attachment")
Call doc.SEND(False, arrRecipients)

VBEND
VBRUN>SendNotesEmail

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Sep 05, 2006 2:14 pm

What you do is add parameters to the subroutine/function and pass them in VBRun/VBEval. So here's a skeleton:

Code: Select all

VBSTART
Sub SendNotesEmail(LogFile)

   'bla bla
   sAttachment = LogFile

   'bla bla

End Sub
VBEND

Let>logfile1=c:\whatever....
VBRun>SendNotesEmail,logfile1
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

tfloyd
Newbie
Posts: 5
Joined: Mon Aug 28, 2006 9:53 pm

Post by tfloyd » Tue Sep 05, 2006 2:30 pm

Thanks, it worked of course.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts