ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   excel with project embeded in it (https://www.excelbanter.com/excel-programming/305587-excel-project-embeded.html)

greg

excel with project embeded in it
 
Hello,
I have Excel with project embeded in it. (insert objectms project
document)
from excel vba i would like to talk to project.
so i am trying this

Dim x As Excel.Worksheet
Set x = ThisWorkbook.ActiveSheet
Set y = x.OLEObjects(1)
c = y.Tasks.Count

i would think that y is project. but it does not seem like it.

can anyone help?

thanks



Debra Dalgleish

excel with project embeded in it
 
Something like:

Dim x As Worksheet
Dim y As Object
Dim c As Integer
Set x = ThisWorkbook.ActiveSheet
Set y = x.OLEObjects(1)
y.Verb
c = ActiveProject.Tasks.Count
Debug.Print c


greg wrote:
Hello,
I have Excel with project embeded in it. (insert objectms project
document)
from excel vba i would like to talk to project.
so i am trying this

Dim x As Excel.Worksheet
Set x = ThisWorkbook.ActiveSheet
Set y = x.OLEObjects(1)
c = y.Tasks.Count

i would think that y is project. but it does not seem like it.

can anyone help?

thanks




--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html


greg

excel with project embeded in it
 
Hello,
Thank you for your response.
I get an "object required", when using this code:
c = ActiveProject.Tasks.Count
so I added this:
c = y.ActiveProject.Tasks.Count
and get this:
"object doesn't support this property or method"

I am using office 2003. does yours work?

thanks


"Debra Dalgleish" wrote in message
...
Something like:

Dim x As Worksheet
Dim y As Object
Dim c As Integer
Set x = ThisWorkbook.ActiveSheet
Set y = x.OLEObjects(1)
y.Verb
c = ActiveProject.Tasks.Count
Debug.Print c


greg wrote:
Hello,
I have Excel with project embeded in it. (insert objectms project
document)
from excel vba i would like to talk to project.
so i am trying this

Dim x As Excel.Worksheet
Set x = ThisWorkbook.ActiveSheet
Set y = x.OLEObjects(1)
c = y.Tasks.Count

i would think that y is project. but it does not seem like it.

can anyone help?

thanks




--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html




Debra Dalgleish

excel with project embeded in it
 
Yes, it works for me in Excel 2003.

You should have a reference set to MS Project --
in the VBE, choose ToolsReferences, and add a check mark to
Microsoft Project 11.0 Object Library

greg wrote:
Hello,
Thank you for your response.
I get an "object required", when using this code:
c = ActiveProject.Tasks.Count
so I added this:
c = y.ActiveProject.Tasks.Count
and get this:
"object doesn't support this property or method"

I am using office 2003. does yours work?

thanks


"Debra Dalgleish" wrote in message
...

Something like:

Dim x As Worksheet
Dim y As Object
Dim c As Integer
Set x = ThisWorkbook.ActiveSheet
Set y = x.OLEObjects(1)
y.Verb
c = ActiveProject.Tasks.Count
Debug.Print c


greg wrote:

Hello,
I have Excel with project embeded in it. (insert objectms project
document)
from excel vba i would like to talk to project.
so i am trying this

Dim x As Excel.Worksheet
Set x = ThisWorkbook.ActiveSheet
Set y = x.OLEObjects(1)
c = y.Tasks.Count

i would think that y is project. but it does not seem like it.

can anyone help?

thanks




--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html






--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html


greg

excel with project embeded in it
 
Thanks for the help.
got it now

Dim x As Worksheet
Dim y As Object
Dim c As Integer
Set x = ThisWorkbook.ActiveSheet
Set y = x.OLEObjects(1)
y.Verb
c = y.Object.Tasks.Count
MsgBox "tasks - " + Str(c)





"Debra Dalgleish" wrote in message
...
Yes, it works for me in Excel 2003.

You should have a reference set to MS Project --
in the VBE, choose ToolsReferences, and add a check mark to
Microsoft Project 11.0 Object Library

greg wrote:
Hello,
Thank you for your response.
I get an "object required", when using this code:
c = ActiveProject.Tasks.Count
so I added this:
c = y.ActiveProject.Tasks.Count
and get this:
"object doesn't support this property or method"

I am using office 2003. does yours work?

thanks


"Debra Dalgleish" wrote in message
...

Something like:

Dim x As Worksheet
Dim y As Object
Dim c As Integer
Set x = ThisWorkbook.ActiveSheet
Set y = x.OLEObjects(1)
y.Verb
c = ActiveProject.Tasks.Count
Debug.Print c


greg wrote:

Hello,
I have Excel with project embeded in it. (insert objectms project
document)
from excel vba i would like to talk to project.
so i am trying this

Dim x As Excel.Worksheet
Set x = ThisWorkbook.ActiveSheet
Set y = x.OLEObjects(1)
c = y.Tasks.Count

i would think that y is project. but it does not seem like it.

can anyone help?

thanks




--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html






--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html





All times are GMT +1. The time now is 12:03 AM.

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