Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Run-Time error 462

I have a script that starts MS Project and opens a project file (.mpp) and
then copies some of the data over into excel.

The first time i run it there is no problem but if i run it again i get a
error

Run-time error 462

The remote server machine does not exist or is unavalable

can anyone help me

CODE

Sub project()
'
Set mwb = Workbooks("Project_Plan.xls")
Set pd = Sheets("Project Data")
Set sp = Sheets("Baseline")
Set sf = Sheets("Forecast")
Set sa = Sheets("Actual")
Set se = Sheets("Control")
Set st = Sheets("Temp")
'
'
Dim proApp As MSProject.Application
Dim proDoc As MSProject.Projects
'
plen = pd.Range("plen")
sdate = pd.Range("sdate")
fdate = pd.Range("fdate")
plen = Application.WorksheetFunction.RoundUp(plen, 0)
'
Set proApp = CreateObject("MSProject.Application")
proApp.Visible = True
proApp.FileOpen Name:="H:\Work\VBA Macro\a1.mpp", ReadOnly:=False,
FormatID:="MSProject.MPP"
'
pveiew = MSProject.ActiveProject.CurrentView
If pview = "Task Usage" Then
Else
ViewApply Name:="Task Usage"
End If
'
OutlineShowTasks OutlineNumber:=pjTaskOutlineShowLevel1
PaneNext
SelectTimescaleRange Row:=1, StartTime:=sdate, Width:=plen + 3, Height:=1
EditCopy
'
ViewApply Name:="Gantt Chart"
'
mwb.Activate
st.Select
st.Range("A1").Select
ActiveSheet.PasteSpecial Format:="Unicode Text", Link:=False, _
DisplayAsIcon:=False
'
proApp.DisplayAlerts = False
proApp.FileClose
proApp.DisplayAlerts = True
proApp.Quit ' close the application
'
mwb.Activate
se.Select
'
End Sub




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
run-time error '1004': Application-defined or object-deifined error [email protected] Excel Programming 5 August 10th 05 09:39 PM
Run time error '1004': Generaol ODBC error Dwaine Horton[_3_] Excel Programming 2 April 26th 05 02:52 PM
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error rdavis7408 Excel Programming 1 August 25th 04 03:54 AM
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) Tim[_36_] Excel Programming 4 April 23rd 04 02:53 AM


All times are GMT +1. The time now is 07:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"