PDA

View Full Version : Exporting Excel to MS Project



Phatie17
06-25-2007, 12:51 PM
Hi,

I am having a problem exporting data from excel to project. This problem only happens sometimes and I do not know what is kicking it off.

Right now I have code from excel that is opening up a current project in ms project then opening up an excel file within project and going through all the settings. A couple of things I need help with are the following:

1. Open up a blank project in ms project via vba from excel (currently opening an existing project in ms project)

2. I will be running this macro many times with different data, so would I have to change the "MapEdit Name" every time

3. Stop this error from occurring.

Run Time Error '462'
The remote server machine does not exist or is unavailable.


This error NEVER happens if I open up MS project before I run the macro.


****Below is my code****

ActiveWorkbook.Save
strFilename = ThisWorkbook.FullName

Set prApp = New MSProject.Application

prApp.FileOpen "D:\Documents and Settings\adrian.martinez\Desktop\ACN\Wells Fargo\Estimating\CORE PMO Estimator\Work Plan Generation\New Utility\WorkPlans\Workplan Generation 20070523 v 1 0.mpp"

Set prProject = prApp.ActiveProject

MapEdit Name:="Map 5", Create:=True, OverwriteExisting:=True, DataCategory:=0, CategoryEnabled:=True, TableName:="WorkPlan", FieldName:="Name", ExternalFieldName:="Name", ExportFilter:="All Tasks", ImportMethod:=0, HeaderRow:=True, AssignmentData:=False, TextDelimiter:=Chr$(9), TextFileOrigin:=0, UseHtmlTemplate:=False, IncludeImage:=False

MapEdit Name:="Map 5", DataCategory:=0, FieldName:="Outline Level", ExternalFieldName:="Outline Level"

MapEdit Name:="Map 5", DataCategory:=0, FieldName:="Work", ExternalFieldName:="Work"

MapEdit Name:="Map 5", DataCategory:=0, FieldName:="Text1", ExternalFieldName:="Build Part Description"

MapEdit Name:="Map 5", DataCategory:=0, FieldName:="Text2", ExternalFieldName:="Sharepoint ID"

FileOpen Name:=strFilename, ReadOnly:=False, Merge:=0, FormatID:="MSProject.XLS8", Map:="Map 5"

SelectTaskColumn Column:="Text19"

TableEdit Name:="&Entry", TaskTable:=True, NewName:="", FieldName:="", NewFieldName:="Text1", Title:="Build Part Description", Width:=10, Align:=2, ShowInMenu:=True, LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, ColumnPosition:=2, AlignTitle:=1

TableApply Name:="&Entry"

SelectTaskColumn Column:="Text19"

TableEdit Name:="&Entry", TaskTable:=True, NewName:="", FieldName:="", NewFieldName:="Text2", Title:="SharePoint IDs", Width:=10, Align:=2, ShowInMenu:=True, LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, ColumnPosition:=3, AlignTitle:=1

TableApply Name:="&Entry"

SelectTaskColumn Column:="Text19"

TableEdit Name:="&Entry", TaskTable:=True, NewName:="", FieldName:="", NewFieldName:="Outline Level", Title:="", Width:=10, Align:=2, ShowInMenu:=True, LockFirstColumn:=True, DateFormat:=255, RowHeight:=1, ColumnPosition:=4, AlignTitle:=1

TableApply Name:="&Entry"

Charlize
07-03-2007, 02:30 AM
maybe dim prApp before setting a new MSproject to it (not tested)Dim prApp As Object
Set prApp = CreateObject("Project.Application")