Import a printable gantt chart from MsProject to Excel

G

Guest

I would like to be able to import a gantt chart from MSProject to Excel that
will be printable from the Excel worksheet.

I tried creating a connection to MSProject and then opening a recordset to
return tasks, dates fields and then binding the recordset, but the resulting
gantt chart which displays in Excel does not print when I print the sheet.

Is there some way that I can transfer this data in gantt chart formatting
that I can then print from the Excel sheet?

I appreciate any help you can give me on this!
 
J

JulieD

Hi Marjie

if you want a "picture" of your gantt chart in an excel worksheet that
prints, in Project use the camera icon on the standard toolbar to generate a
gif and then put that in excel.

if you're after somthing else, please post your code as i'm interested to
see the "gantt chart which displays in excel" ... and then hopefully from
there figure out why it doesn't print

Cheers
JulieD
 
G

Guest

I will try that. I am gathering a variety of information from a variety of
sources and pulling it all together in an Excel spreadsheet (including
charts, pictures, data) and then using the sheet for distribution purposes as
well as printing.

The code I spoke of that displays the gant chart in EXCEL, but won't print is:

Dim con As New Connection
Dim rs As New Recordset
Dim sql As String
Dim constr As String

constr =
"Provider=sqloledb;Server=ServerName;database=dbName;trusted_connection=yes"
con.Open constr

sql = "SELECT TASK_NAME, START_DATE, FINISH_DATE FROM MSP_PROJECTS WHERE
PROJ_ID > 4 ORDER BY PROJ_NAME"

rs.Open sql, con, adOpenStatic, adLockReadOnly

Me.MSPJGrid1.Binding = rs
Me.MSPJGrid1.FieldList = "TASK_NAME,START_DATE[Start],FINISH_DATE[Finish]"
Me.MSPJGrid1.Outlining = False
Me.MSPJGrid1.GanttView = True
Me.MSPJGrid1.PrintObject=True
Me.MSPJGrid1.Width = 900
Me.MSPJGrid1.Refresh
 
J

JulieD

Hi Marjie

glad it worked for you. I was very interested in your code - but couldn't
get it to run (don't know much about connection strings) - do you have any
references where i could learn more about this topic

Regards
JulieD
 
G

Guest

I forgot to mention that I had the code running on the activate event of the
worksheet. As for the connection string, I was working with code from a
coworker so I'm afraid I don't know much about connection strings either.
 
J

JulieD

okay, i'll start "googling"

Cheers
JulieD

Marjie said:
I forgot to mention that I had the code running on the activate event of
the
worksheet. As for the connection string, I was working with code from a
coworker so I'm afraid I don't know much about connection strings either.
 

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