A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

VBA script not working



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 18th 07, 01:50 AM posted to microsoft.public.outlook.program_vba
ChrisCharles
external usenet poster
 
Posts: 3
Default VBA script not working

Hi there, I have an email sent to me when a file has finished backing up on
my server. It is sent with the Subject of the email as follows:

Status change for *file.xyz*

I am trying to create a script that processes this Subject line and then
launches an FTP client with the right parameters in order to download the
backup file. Currently I am not passing the parameters as I cannot get it to
work yet. I have a fair bit of experience with C/C++ but am a total beginner
to VBA, I was wondering if somebody could help me as to why this script isnt
working.




Sub StartFTPTransfer(TheEMail As Outlook.MailItem)

Dim Subject As String
Subject = TheEMail.Subject
Dim SubjectArray() As String

For Arrayify = 1 To Len(Subject)
SubjectArray = Mid(Subject, Arrayify, 1)
Next Arrayify

Dim i As Integer
i = 0
Do Until SubjectArray(i) = "*"
i = i + 1
Loop

Dim FileName As String
Do Until SubjectArray(i) = "*"
FileName = FileName & SubjectArray(i)
i = i + 1
Loop

Dim stAppName As String
stAppName = "D:\Program Files\FlashFXP\FlashFXP.exe"
Call Shell(stAppName, vbMaximizedFocus)

End Sub
Ads
  #2  
Old April 18th 07, 02:08 AM posted to microsoft.public.outlook.program_vba
ChrisCharles
external usenet poster
 
Posts: 3
Default VBA script not working

Sorry I forgot to say that it compiles fine in the Visual Basic window that
opens when you select 'Tools\Macro\Visual Basic Editor'. However, when the
rule finds an email and runs it, the script does nothing (or at least it isnt
opening any windows/...)

Thanks again
  #3  
Old April 19th 07, 08:10 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default VBA script not working

Let's first rule out your code and see if the rule itself isn't firing.
Comment out everything and add a MsgBox "Hello world" line. If that works,
uncomment your code and try loading Notepad.exe with the Shell call.

Let me know what you find.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"ChrisCharles" wrote:

Hi there, I have an email sent to me when a file has finished backing up on
my server. It is sent with the Subject of the email as follows:

Status change for *file.xyz*

I am trying to create a script that processes this Subject line and then
launches an FTP client with the right parameters in order to download the
backup file. Currently I am not passing the parameters as I cannot get it to
work yet. I have a fair bit of experience with C/C++ but am a total beginner
to VBA, I was wondering if somebody could help me as to why this script isnt
working.




Sub StartFTPTransfer(TheEMail As Outlook.MailItem)

Dim Subject As String
Subject = TheEMail.Subject
Dim SubjectArray() As String

For Arrayify = 1 To Len(Subject)
SubjectArray = Mid(Subject, Arrayify, 1)
Next Arrayify

Dim i As Integer
i = 0
Do Until SubjectArray(i) = "*"
i = i + 1
Loop

Dim FileName As String
Do Until SubjectArray(i) = "*"
FileName = FileName & SubjectArray(i)
i = i + 1
Loop

Dim stAppName As String
stAppName = "D:\Program Files\FlashFXP\FlashFXP.exe"
Call Shell(stAppName, vbMaximizedFocus)

End Sub

  #4  
Old April 20th 07, 11:34 AM posted to microsoft.public.outlook.program_vba
ChrisCharles
external usenet poster
 
Posts: 3
Default VBA script not working

Thanks for your help, I managed to sort it by signing the script.

I have also completely rewritten the script as I realised what a stupid way
of doing the task it was.

Its working fine now, thanks again
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlk 2k3 Script: Saving Excel File programticaly from OUTLOOK SCRIPT news.microsoft.com Outlook and VBA 3 November 22nd 06 03:33 PM
Run A SCRIPT - Select Script EMPTY mitupan116 Outlook and VBA 1 November 2nd 06 09:36 PM
Help with a script batesharold@hotmail.com Outlook and VBA 7 September 19th 06 06:16 AM
Rule 'run a script' not running my script s.parsley@ntlworld.com Outlook and VBA 3 May 30th 06 12:09 PM
"Run a script" rule triggers but script does not execute Trey Shaffer Outlook and VBA 7 April 7th 06 11:34 PM


All times are GMT +1. The time now is 07:05 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.