What is Attributes and WithEvents???

M

masani paresh

Hi All,

Could anyone please help me to understand below code. It shows me systax
error when I copy paste in ThisOutlookSession in my outlook.

VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
End
VB_Name = "ThisOutlookSession"
VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Public WithEvents colExplorers As Outlook.Explorers
Attribute colExplorers.VB_VarHelpID = -1
Public WithEvents objExplorer As Outlook.Explorer
Attribute objExplorer.VB_VarHelpID = -1
 
K

Ken Slovak - [MVP - Outlook]

Well, for one thing BEGIN...END blocks aren't VBA code, so I'd expect
errors. That looks like some Pascal or Delphi type code. VERSION also isn't
VBA code.

None of the variables is declared as to type, which will make them all
Variants if Option Explicit is off, with that option on there are more
errors.

Attribute is also not VBA code, unless it's qualified as to what it refers
to.

WithEvents is VBA/VB for declaring an object that handles events and makes
those events accessible to you code.

That looks like some weird mix of VBA and Delphi or Pascal code to me. I'd
expect lots of errors.
 
S

Sue Mosher [MVP-Outlook]

Actually, it looks like what you get if you export the ThisOutlookSession
module from VBA to a .cls file and then open that .cls file in Notepad. It
should be possible to import the file into VBA and then see the imported code
in the new class module that the import creates.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54




Ken Slovak - said:
Well, for one thing BEGIN...END blocks aren't VBA code, so I'd expect
errors. That looks like some Pascal or Delphi type code. VERSION also isn't
VBA code.

None of the variables is declared as to type, which will make them all
Variants if Option Explicit is off, with that option on there are more
errors.

Attribute is also not VBA code, unless it's qualified as to what it refers
to.

WithEvents is VBA/VB for declaring an object that handles events and makes
those events accessible to you code.

That looks like some weird mix of VBA and Delphi or Pascal code to me. I'd
expect lots of errors.
 
M

masani paresh

Perferctly correct Sue. You are really great. I have purchased your two books
on Configuration Outlook 2003 and Microsof Outlook 2007 programming. Its
awesome.

We have been facing so many problems in free/busy information while booking
conference through outlook. Actually problem is free/busy status is not
getting updated immediately once user booked the conference room and mean
while some other user select the same conference as he can see the free
status.

If you have any ideas on this issue or your any of book talk about this then
please let me know. Actually I purchase Configuring Microsoft Outlook for
this issue but it didn't help much.

--
Thanks,
Paresh


Sue Mosher said:
Actually, it looks like what you get if you export the ThisOutlookSession
module from VBA to a .cls file and then open that .cls file in Notepad. It
should be possible to import the file into VBA and then see the imported code
in the new class module that the import creates.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
M

masani paresh

Thanks Ken for you reply.
--
Thanks,
Paresh


Ken Slovak - said:
Well, for one thing BEGIN...END blocks aren't VBA code, so I'd expect
errors. That looks like some Pascal or Delphi type code. VERSION also isn't
VBA code.

None of the variables is declared as to type, which will make them all
Variants if Option Explicit is off, with that option on there are more
errors.

Attribute is also not VBA code, unless it's qualified as to what it refers
to.

WithEvents is VBA/VB for declaring an object that handles events and makes
those events accessible to you code.

That looks like some weird mix of VBA and Delphi or Pascal code to me. I'd
expect lots of errors.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top