How to capture MsgBox result and paste into Excel

M

Marty

I have generated a number of VBA modules that count various types of tasks in
a project and display the count total in a Message box. But there doesn't
appear to be a way to copy or cut the number out of the message box. How do
I get the total number out of the message box and pasted into Excel? Or how
do I get the total count some other way in project so I can paste it into
Excel? A sample of my VBA code is below.

Sub Total_Completed_Number_of_Tasks()
Dim T As Task
Dim C As Long

For Each T In ActiveProject.Tasks
If Not (T Is Nothing) Then
If T.Summary = False Then
If T.PercentComplete = 100 Then
C = C + 1
End If
End If
End If
Next T

MsgBox Prompt:="The Project Contains " _
& C & " Completed non-Summary tasks"

End Sub
 
M

Mike Glen

Hi Marty ,

Try posting on the developer newsgroup. Please see FAQ Item: 24. Project
Newsgroups. FAQs, companion products and other useful Project information
can be seen at this web address: http://www.mvps.org/project/.

Mike Glen
Project MVP


wrote:
 
M

Marty

Hi Mike,
You have responsed three times to posts of mine and every time you tell me
to post on the server or developer list. I try and post my questions on the
Highest level Microsoft Project list level so it will go to all three
subordinate lists (including the developer and server lists). Does the post
not work this way?
 
J

John

Marty said:
Hi Mike,
You have responsed three times to posts of mine and every time you tell me
to post on the server or developer list. I try and post my questions on the
Highest level Microsoft Project list level so it will go to all three
subordinate lists (including the developer and server lists). Does the post
not work this way?


Marty,
No, it doesn't work that way. Each newsgroup is separate and
unfortunately some people post the same message on more than one group
(i.e. shotgun approach). That can cause a problem for the following
reason. Those of us who respond to questions on MS Project generally
check all of the newsgroups. Sometimes we respond to a question on one
newsgroup and not realize that another MVP is responding to the same
question on another group. The end result is that one of us probably
wasted our time.

John
Project MVP
 
M

Mike Glen

Hi Marty,

As John said, every newsgroup is different and you need to address the
correct newsgroup to attract answers from the experts in that field, and it
saves us time in having to read posts that we are unlikely to be able
answer! It also leaves this newsgroup with general Project questions and
prevents people from having to wade through irrelevant posts.

However, I'm interested in your comment about "Highest Level" - where on
earth (or Internet) did you get the idea that there was a top level and
subordinates? If a website is giving an impression of a hierarchy, we'd
like to get it changed :)


Mike Glen
Project MVP
 
M

Marty

Thanks Mike,
On the Project Post page under the In: drop down box, Project General
Questions, Server, and Developers/Programmers are indented under the Higher
Level heading of Microsoft Project. I inferred, incorrectly, that there was
a hierarchy or roll up of the three subordinate topics under the generic
project topic. My mistake. I am sorry to have wasted your and John's
valuable time. Now that I understand there is not a hierarchy, I will try
and post my questions under what appers to me to be the most salient heading.
 
J

John

Marty said:
Thanks Mike,
On the Project Post page under the In: drop down box, Project General
Questions, Server, and Developers/Programmers are indented under the Higher
Level heading of Microsoft Project. I inferred, incorrectly, that there was
a hierarchy or roll up of the three subordinate topics under the generic
project topic. My mistake. I am sorry to have wasted your and John's
valuable time. Now that I understand there is not a hierarchy, I will try
and post my questions under what appers to me to be the most salient heading.


Marty,
I can't speak for Mike, but you don't need to apologize for wasting my
time - you didn't. I think we both just wanted to get the message out
about duplicate posts. Now you understand - mission accomplished.

From my viewpoint the best case is if posters do post in the correct
newsgroup but I'll admit that sometimes isn't always easy to determine.
I work with general Project questions and questions on VBA so I don't
mind seeing a VBA question on the regular newsgroup. I am more sensitive
to cross posting on more than one newsgroup however for the reason
mentioned previously. The other MPVs do not necessarily share my view.

John
 
M

Mike Glen

Hi Marty,

I agree wholeheartedly with what John says, particularly with
cross-posting - no need to apologise :) Most of my posts referring people
to the correct newsgroup are done so that hopefully others will see the
redirect and act on it. I also post in that way so that posters become
aware of the Project FAQs, where they may well find their answer :)

I've been trying to follow up the page you mentioned, but I can't find it.
Could you try again and post the URL?

Thanks

Mike Glen
Project MVP
 

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