ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with .Add specification (https://www.excelbanter.com/excel-programming/316805-help-add-specification.html)

Norman Peelman

Help with .Add specification
 
Hi group,

I'm using PHP5 to program Excel vie COM interface and have run into a snag
( for me anyway ). I am trying to use the .Add method on a Worksheet and
can't figure out the following:

From microsoft: (optional are 'Before, After, Count, Type)
ActiveWorkbook.Sheets.Add Befo=Worksheets(Worksheets.Count)


turns into PHP:
$this-excel-Worksheets-Add()

except I don't know how to specify 'Before, After, Count, Type' as options.?
It will accept one 'sheet obj' as an argument such as:

$this-excel-Worksheets-Add($this-excel-Worksheets(2))
but how do I specify if it's 'Before' or 'After' as well as 'Count' and
'Type'?

This doesn't work for me: (pseudo VB style)
$this-excel-Worksheets-Add(Befo=??, After:=??, Count:=??,
Type:=xlWorksheet)

Can anyone point me in the right direction?

Thanks,
Norman



--
Avatar hosting at www.easyavatar.com



Bob Phillips[_6_]

Help with .Add specification
 
Norman,

Is it as simple as enclosing those parts in parentheses (brackets), making
sure that they are fully qualified?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Norman Peelman" wrote in message
...
Hi group,

I'm using PHP5 to program Excel vie COM interface and have run into a

snag
( for me anyway ). I am trying to use the .Add method on a Worksheet and
can't figure out the following:

From microsoft: (optional are 'Before, After, Count, Type)
ActiveWorkbook.Sheets.Add Befo=Worksheets(Worksheets.Count)


turns into PHP:
$this-excel-Worksheets-Add()

except I don't know how to specify 'Before, After, Count, Type' as

options.?
It will accept one 'sheet obj' as an argument such as:

$this-excel-Worksheets-Add($this-excel-Worksheets(2))
but how do I specify if it's 'Before' or 'After' as well as 'Count' and
'Type'?

This doesn't work for me: (pseudo VB style)
$this-excel-Worksheets-Add(Befo=??, After:=??, Count:=??,
Type:=xlWorksheet)

Can anyone point me in the right direction?

Thanks,
Norman



--
Avatar hosting at www.easyavatar.com





Norman Peelman

Help with .Add specification
 
"Bob Phillips" wrote in message
...
Norman,

Is it as simple as enclosing those parts in parentheses (brackets), making
sure that they are fully qualified?

--


Bob,

I guess I don't understand the 'qualification'. I have tried many
different ways and can only get one argument to pass in. Maybe if someone
could provide a C/C++ example using all four parameters? If all else fails I
can program around it by doing externally what Excel is doing internally.
Sorry if this is off topic.

Thanks,

Norman


HTH

RP
(remove nothere from the email address if mailing direct)


"Norman Peelman" wrote in message
...
Hi group,

I'm using PHP5 to program Excel vie COM interface and have run into a

snag
( for me anyway ). I am trying to use the .Add method on a Worksheet and
can't figure out the following:

From microsoft: (optional are 'Before, After, Count, Type)
ActiveWorkbook.Sheets.Add Befo=Worksheets(Worksheets.Count)


turns into PHP:
$this-excel-Worksheets-Add()

except I don't know how to specify 'Before, After, Count, Type' as

options.?
It will accept one 'sheet obj' as an argument such as:

$this-excel-Worksheets-Add($this-excel-Worksheets(2))
but how do I specify if it's 'Before' or 'After' as well as 'Count' and
'Type'?

This doesn't work for me: (pseudo VB style)
$this-excel-Worksheets-Add(Befo=??, After:=??, Count:=??,
Type:=xlWorksheet)

Can anyone point me in the right direction?

Thanks,
Norman



--
Avatar hosting at www.easyavatar.com







Bob Phillips[_6_]

Help with .Add specification
 
Norman,

By fully qualified, I mean make sure that each object has an application,
workbook, worksheet , etc., identifier.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Norman Peelman" wrote in message
.. .
"Bob Phillips" wrote in message
...
Norman,

Is it as simple as enclosing those parts in parentheses (brackets),

making
sure that they are fully qualified?

--


Bob,

I guess I don't understand the 'qualification'. I have tried many
different ways and can only get one argument to pass in. Maybe if someone
could provide a C/C++ example using all four parameters? If all else fails

I
can program around it by doing externally what Excel is doing internally.
Sorry if this is off topic.

Thanks,

Norman


HTH

RP
(remove nothere from the email address if mailing direct)


"Norman Peelman" wrote in message
...
Hi group,

I'm using PHP5 to program Excel vie COM interface and have run into

a
snag
( for me anyway ). I am trying to use the .Add method on a Worksheet

and
can't figure out the following:

From microsoft: (optional are 'Before, After, Count, Type)
ActiveWorkbook.Sheets.Add Befo=Worksheets(Worksheets.Count)


turns into PHP:
$this-excel-Worksheets-Add()

except I don't know how to specify 'Before, After, Count, Type' as

options.?
It will accept one 'sheet obj' as an argument such as:

$this-excel-Worksheets-Add($this-excel-Worksheets(2))
but how do I specify if it's 'Before' or 'After' as well as 'Count'

and
'Type'?

This doesn't work for me: (pseudo VB style)
$this-excel-Worksheets-Add(Befo=??, After:=??, Count:=??,
Type:=xlWorksheet)

Can anyone point me in the right direction?

Thanks,
Norman



--
Avatar hosting at www.easyavatar.com









Norman Peelman

Help with .Add specification
 
"Bob Phillips" wrote in message
...
Norman,

By fully qualified, I mean make sure that each object has an application,
workbook, worksheet , etc., identifier.

--


Well, I thought I did. I have tried by setting up separate variables for
each:

$Before = sheet_obj;
$After = sheet_obj;
$Count = integer number;
$Type = xlWorksheet; // I have all the constants defined through the COM
object

I guess the question becomes: If both 'Before' and 'After' are sheet objects
and are optional, how does the function receive the arguments?

ActiveWorkbook.Sheets.Add Befo=Worksheets(Worksheets.Count)

I assumed that 'Befo=' is a variable assignment of some sort. How is the
'Worksheets(??)' object actually being passed to the function that indicates
it is the 'Before' property? How is 'Before' being sent to the function?

I would assume that:

ActiveWorkbook.Sheets.Add Befo=Worksheets(4) After:=Worksheets(2)
Count:=2 Type:=xlWorksheet

would insert 2 new worksheets somewhere After 2 and Before 4
but I can't figure out how the assignments are being handled.

Thanks again,

Norm




HTH

RP
(remove nothere from the email address if mailing direct)


"Norman Peelman" wrote in message
.. .
"Bob Phillips" wrote in message
...
Norman,

Is it as simple as enclosing those parts in parentheses (brackets),

making
sure that they are fully qualified?

--


Bob,

I guess I don't understand the 'qualification'. I have tried many
different ways and can only get one argument to pass in. Maybe if

someone
could provide a C/C++ example using all four parameters? If all else

fails
I
can program around it by doing externally what Excel is doing

internally.
Sorry if this is off topic.

Thanks,

Norman


HTH

RP
(remove nothere from the email address if mailing direct)


"Norman Peelman" wrote in message
...
Hi group,

I'm using PHP5 to program Excel vie COM interface and have run

into
a
snag
( for me anyway ). I am trying to use the .Add method on a Worksheet

and
can't figure out the following:

From microsoft: (optional are 'Before, After, Count, Type)
ActiveWorkbook.Sheets.Add Befo=Worksheets(Worksheets.Count)


turns into PHP:
$this-excel-Worksheets-Add()

except I don't know how to specify 'Before, After, Count, Type' as
options.?
It will accept one 'sheet obj' as an argument such as:

$this-excel-Worksheets-Add($this-excel-Worksheets(2))
but how do I specify if it's 'Before' or 'After' as well as 'Count'

and
'Type'?

This doesn't work for me: (pseudo VB style)
$this-excel-Worksheets-Add(Befo=??, After:=??, Count:=??,
Type:=xlWorksheet)

Can anyone point me in the right direction?

Thanks,
Norman



--
Avatar hosting at www.easyavatar.com












All times are GMT +1. The time now is 04:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com