![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Which is the error in this VBS I have the following routine to add date to the subject, but alone of the marked the first messages, someone can say to me in that I am wrong Thank Sub añado_fecha_asunto() Dim ol As Object Dim olns As Object Dim dia, mes Dim strfecha As String Dim asuntofecha As String Dim i As Integer If Day(Date) < 10 Then dia = "0" & Day(Date) End If If Day(Date) >= 10 Then dia = Day(Date) End If ' añado un 0 si el mes tiene un digito If Month(Date) < 10 Then mes = "0" & Month(Date) End If If Month(Date) >= 10 Then mes = Month(Date) End If ' Pongo variable strfecha a la cabecera necesaria strfecha = ("09" & " - " & mes & " - " & dia & " ") Set ol = New Outlook.Application Set olns = ol.GetNamespace("MAPI") Set myFolder = ol.ActiveExplorer.CurrentFolder numitems = ol.ActiveExplorer.Selection.Count For i = 1 To numitems ' MsgBox ol.ActiveExplorer.Selection.Item(i).Subject asuntofecha = strfecha & ol.ActiveExplorer.Selection.Item(i).Subject MsgBox asuntofecha ol.ActiveExplorer.Selection.Item(i).Subject = asuntofecha Next i End Sub |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Which is the error in this VBS "Javier VFM" <JavierVFM@xxxxxx> wrote in message news:67FAA8AC-827A-4DAE-A24F-2A3515FFE2BF@xxxxxx Quote: >I have the following routine to add date to the subject, but alone of the > marked the first messages, someone can say to me in that I am wrong > > Thank > > Sub añado_fecha_asunto() > > Dim ol As Object > Dim olns As Object > Dim dia, mes > Dim strfecha As String > Dim asuntofecha As String > > Dim i As Integer > > If Day(Date) < 10 Then > dia = "0" & Day(Date) > End If > > If Day(Date) >= 10 Then > dia = Day(Date) > End If > > ' añado un 0 si el mes tiene un digito > > If Month(Date) < 10 Then > mes = "0" & Month(Date) > End If > > If Month(Date) >= 10 Then > mes = Month(Date) > End If > > ' Pongo variable strfecha a la cabecera necesaria > > strfecha = ("09" & " - " & mes & " - " & dia & " ") > > > Set ol = New Outlook.Application > Set olns = ol.GetNamespace("MAPI") > Set myFolder = ol.ActiveExplorer.CurrentFolder > > numitems = ol.ActiveExplorer.Selection.Count > > For i = 1 To numitems > > > ' MsgBox ol.ActiveExplorer.Selection.Item(i).Subject > > > asuntofecha = strfecha & > ol.ActiveExplorer.Selection.Item(i).Subject > > MsgBox asuntofecha > > ol.ActiveExplorer.Selection.Item(i).Subject = asuntofecha > > > Next i > > > > > > End Sub > VBScript. None of the Dim statements should have the "AS" keyword. When objects are created, use either CreateObject or GetObject methods in VBScript. -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Which is the error in this VBS I am sorry but is a Vba proyect and is a macro in the VB outlook. is correct or no "Richard Mueller [MVP]" wrote: Quote: > > "Javier VFM" <JavierVFM@xxxxxx> wrote in message > news:67FAA8AC-827A-4DAE-A24F-2A3515FFE2BF@xxxxxx Quote: > >I have the following routine to add date to the subject, but alone of the > > marked the first messages, someone can say to me in that I am wrong > > > > Thank > > > > Sub añado_fecha_asunto() > > > > Dim ol As Object > > Dim olns As Object > > Dim dia, mes > > Dim strfecha As String > > Dim asuntofecha As String > > > > Dim i As Integer > > > > If Day(Date) < 10 Then > > dia = "0" & Day(Date) > > End If > > > > If Day(Date) >= 10 Then > > dia = Day(Date) > > End If > > > > ' añado un 0 si el mes tiene un digito > > > > If Month(Date) < 10 Then > > mes = "0" & Month(Date) > > End If > > > > If Month(Date) >= 10 Then > > mes = Month(Date) > > End If > > > > ' Pongo variable strfecha a la cabecera necesaria > > > > strfecha = ("09" & " - " & mes & " - " & dia & " ") > > > > > > Set ol = New Outlook.Application > > Set olns = ol.GetNamespace("MAPI") > > Set myFolder = ol.ActiveExplorer.CurrentFolder > > > > numitems = ol.ActiveExplorer.Selection.Count > > > > For i = 1 To numitems > > > > > > ' MsgBox ol.ActiveExplorer.Selection.Item(i).Subject > > > > > > asuntofecha = strfecha & > > ol.ActiveExplorer.Selection.Item(i).Subject > > > > MsgBox asuntofecha > > > > ol.ActiveExplorer.Selection.Item(i).Subject = asuntofecha > > > > > > Next i > > > > > > > > > > > > End Sub > > > The code is classic VB rather than VBScript. You cannot type variables in > VBScript. None of the Dim statements should have the "AS" keyword. When > objects are created, use either CreateObject or GetObject methods in > VBScript. > > -- > Richard Mueller > MVP Directory Services > Hilltop Lab - http://www.rlmueller.net > -- > > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Which is the error in this VBS In that case you need a VB forum. VB and VBScript are two different beasts. -- Joe Fawcett (MVP - XML) http://joe.fawcett.name "Javier VFM" <JavierVFM@xxxxxx> wrote in message news:7CD71BA5-2043-40A3-B9DE-AD0B13A3CDB8@xxxxxx Quote: > I am sorry but is a Vba proyect and is a macro in the VB outlook. > > is correct or no > > "Richard Mueller [MVP]" wrote: > Quote: >> >> "Javier VFM" <JavierVFM@xxxxxx> wrote in message >> news:67FAA8AC-827A-4DAE-A24F-2A3515FFE2BF@xxxxxx Quote: >> >I have the following routine to add date to the subject, but alone of >> >the >> > marked the first messages, someone can say to me in that I am wrong >> > >> > Thank >> > >> > Sub añado_fecha_asunto() >> > >> > Dim ol As Object >> > Dim olns As Object >> > Dim dia, mes >> > Dim strfecha As String >> > Dim asuntofecha As String >> > >> > Dim i As Integer >> > >> > If Day(Date) < 10 Then >> > dia = "0" & Day(Date) >> > End If >> > >> > If Day(Date) >= 10 Then >> > dia = Day(Date) >> > End If >> > >> > ' añado un 0 si el mes tiene un digito >> > >> > If Month(Date) < 10 Then >> > mes = "0" & Month(Date) >> > End If >> > >> > If Month(Date) >= 10 Then >> > mes = Month(Date) >> > End If >> > >> > ' Pongo variable strfecha a la cabecera necesaria >> > >> > strfecha = ("09" & " - " & mes & " - " & dia & " ") >> > >> > >> > Set ol = New Outlook.Application >> > Set olns = ol.GetNamespace("MAPI") >> > Set myFolder = ol.ActiveExplorer.CurrentFolder >> > >> > numitems = ol.ActiveExplorer.Selection.Count >> > >> > For i = 1 To numitems >> > >> > >> > ' MsgBox ol.ActiveExplorer.Selection.Item(i).Subject >> > >> > >> > asuntofecha = strfecha & >> > ol.ActiveExplorer.Selection.Item(i).Subject >> > >> > MsgBox asuntofecha >> > >> > ol.ActiveExplorer.Selection.Item(i).Subject = asuntofecha >> > >> > >> > Next i >> > >> > >> > >> > >> > >> > End Sub >> > >> The code is classic VB rather than VBScript. You cannot type variables in >> VBScript. None of the Dim statements should have the "AS" keyword. When >> objects are created, use either CreateObject or GetObject methods in >> VBScript. >> >> -- >> Richard Mueller >> MVP Directory Services >> Hilltop Lab - http://www.rlmueller.net >> -- >> >> >> |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Which is the error in this VBS On Thu, 05 Mar 2009 10:41:01 GMT, JavierVFM wrote: Quote: > I have the following routine to add date to the subject, but alone of the > marked the first messages, someone can say to me in that I am wrong Quote: > Dim dia, mes Dim dia As String, mes As String Quote: > End If > If Day(Date) >= 10 Then Quote: > End If > If Month(Date) >= 10 Then My suggestions won't solve your problem, whatever it is. (I don't know anything about Outlook. Your code looks okay to me.) I would ask this question in this group: microsoft.public.office.developer.outlook.vba -- auric dot auric at gmail dot com -- Starting today, all passwords must contain letters, numbers, doodles, sign language, and squirrel noises. |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Which is the error in this VBS or perhaps a VBA forum, as vb, vbscript, and vba are three different beasts. /Al "Joe Fawcett" <joefawcett@xxxxxx> wrote in message news:uvnuxlbnJHA.5412@xxxxxx Quote: > In that case you need a VB forum. VB and VBScript are two different > beasts. > > -- > > Joe Fawcett (MVP - XML) > http://joe.fawcett.name > "Javier VFM" <JavierVFM@xxxxxx> wrote in message > news:7CD71BA5-2043-40A3-B9DE-AD0B13A3CDB8@xxxxxx Quote: >> I am sorry but is a Vba proyect and is a macro in the VB outlook. >> >> is correct or no >> >> "Richard Mueller [MVP]" wrote: >> Quote: >>> >>> "Javier VFM" <JavierVFM@xxxxxx> wrote in message >>> news:67FAA8AC-827A-4DAE-A24F-2A3515FFE2BF@xxxxxx >>> >I have the following routine to add date to the subject, but alone of >>> >the >>> > marked the first messages, someone can say to me in that I am wrong >>> > >>> > Thank >>> > >>> > Sub añado_fecha_asunto() >>> > >>> > Dim ol As Object >>> > Dim olns As Object >>> > Dim dia, mes >>> > Dim strfecha As String >>> > Dim asuntofecha As String >>> > >>> > Dim i As Integer >>> > >>> > If Day(Date) < 10 Then >>> > dia = "0" & Day(Date) >>> > End If >>> > >>> > If Day(Date) >= 10 Then >>> > dia = Day(Date) >>> > End If >>> > >>> > ' añado un 0 si el mes tiene un digito >>> > >>> > If Month(Date) < 10 Then >>> > mes = "0" & Month(Date) >>> > End If >>> > >>> > If Month(Date) >= 10 Then >>> > mes = Month(Date) >>> > End If >>> > >>> > ' Pongo variable strfecha a la cabecera necesaria >>> > >>> > strfecha = ("09" & " - " & mes & " - " & dia & " ") >>> > >>> > >>> > Set ol = New Outlook.Application >>> > Set olns = ol.GetNamespace("MAPI") >>> > Set myFolder = ol.ActiveExplorer.CurrentFolder >>> > >>> > numitems = ol.ActiveExplorer.Selection.Count >>> > >>> > For i = 1 To numitems >>> > >>> > >>> > ' MsgBox ol.ActiveExplorer.Selection.Item(i).Subject >>> > >>> > >>> > asuntofecha = strfecha & >>> > ol.ActiveExplorer.Selection.Item(i).Subject >>> > >>> > MsgBox asuntofecha >>> > >>> > ol.ActiveExplorer.Selection.Item(i).Subject = asuntofecha >>> > >>> > >>> > Next i >>> > >>> > >>> > >>> > >>> > >>> > End Sub >>> > >>> >>> The code is classic VB rather than VBScript. You cannot type variables >>> in >>> VBScript. None of the Dim statements should have the "AS" keyword. When >>> objects are created, use either CreateObject or GetObject methods in >>> VBScript. >>> >>> -- >>> Richard Mueller >>> MVP Directory Services >>> Hilltop Lab - http://www.rlmueller.net >>> -- >>> >>> >>> > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Help with windows vista mail, Socket Error: 10053, Error Number: 0x800CCC0F | Vista mail | |||
| no,socket Error: 11003. Error Number: 0x800CC0D cant i send email name is correctly | Vista mail | |||
| Canot post to newsgroups Socket Error: 10053, Error Number: 0x800CCC0F | Vista mail | |||
| Canot post to newsgroups Socket Error: 10053, Error Number: 0x800CCC0F | Vista General | |||
| windows live mail 2008 (Build 12.0.1606) error report error | Windows Live | |||