Office XP Object Model 
Author Message
 Office XP Object Model

I'm a very, very brand new Office programmer.  I have programming experience
with VBS to some degree and I've completed a few courses in other langues.
However, I'm having trouble getting started automating Office XP with C#.
Specifically, does anyone know of a good place to get the real skinny on
syntax?
As a for instance, how do you know when the ":=" syntax is used and when it
isn't.  I see things like,
" ....SaveAs FileName:= <some value here>

When is the " := " used??

Any pointers to detailed documentation would be most helpful.

Thanks!

Stephen D. Oliver, MCSE



Mon, 01 Aug 2005 14:12:48 GMT  
 Office XP Object Model
Hi Stephen,

Take a look in VBA how to utilize the MsgBox function
and experiment.
Look at below addtl examples as well ...

Quote:
> When is the " := " used??

When using parameter/argument names.

Function Sample(P1, P2, P3) As AType
So 3 parameters P1 ..P3 in this function whereby
in below example
P1 takes 123 as value,
P2 takes 231 and
P3 takes 321

Calling this function can be done:
s = Sample(P1:=123, P2:=231, P3:=321)
but it can also be done by value like
s = Sample(123, 231, 321)

General 'rule': Adding parameternames to yr code, makes it more readable.

There's another reason that might force you into using parameternames
instead of entering parameters by value that is if you want to change the
sequence
of parameters.

In above example:
s = Sample(231, 123, 321)
this won't work
but the following statement does work
s = Sample(P2:=231, P1:=123, P3:=321)
this is where you utilize :=

The last option is when you want to input only 1 out of 3 optional
parameters, like
Function Sample(Optional P1, Optional P2, Optional P3) As AType
In this example, 3 optional parameters P1 ..P3
the following statement will not work, if you only want to pass a value for
parameter P3 (it's value 321)
s = Sample(321)
Instead, VBA will treat it as a value passed to parameter P1 (first in
sequence)

but the following statement will work
s = Sample(P3:=321)
again, in this case the := is desirable

Krgrds,
Perry



Quote:
> I'm a very, very brand new Office programmer.  I have programming
experience
> with VBS to some degree and I've completed a few courses in other langues.
> However, I'm having trouble getting started automating Office XP with C#.
> Specifically, does anyone know of a good place to get the real skinny on
> syntax?
> As a for instance, how do you know when the ":=" syntax is used and when
it
> isn't.  I see things like,
> " ....SaveAs FileName:= <some value here>

> When is the " := " used??

> Any pointers to detailed documentation would be most helpful.

> Thanks!

> Stephen D. Oliver, MCSE



Tue, 02 Aug 2005 07:15:09 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Version info Office Object models

2. Excel object model and localized office 2000

3. Report Object Model/Viewer Object Model

4. Office Assistant Object Model

5. Missing Objects in VBA for Office XP

6. Office 2000 and Office XP question

7. SaveAs in office 2K & Office XP

8. difference Office XP VAB and Office 97 VBA

9. Office XP Run Time Error after upgrade from Office 2000

10. Will Office-97 VBA macros work in Office-XP

11. Behavior under Office 2000 vs. Office XP

12. DatePicker problem under Windows XP and Office XP

 

 
Powered by phpBB® Forum Software