View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Launchnet Launchnet is offline
external usenet poster
 
Posts: 25
Default Macro error when file not found

I have the following Excel macro:

Sub NewExcelWithWorkbook()
Dim oXL As Object
Dim oWB As Object

Set oXL = CreateObject("Excel.Application")
oXL.Visible = True
Set oWB = oXL.Workbooks.Open("C:\documents and settings\default\my
documents\classhandouts.xls")
End Sub

This path works on my PC, but does not work on my daughters as her folder for
\my documents\ is in the path C:\Documents and Settings\User\My Documents

1st question . . . Is there different paths used by Microsoft, or has someone
simply moved things around ?

2nd question . . . When my macro encounters an error, is there a way of
automatically retrying the second path ?

3rd question . . . If Microsoft does use different paths to \my documents\
how do I then solve this problem ?

I am sure someone in your group can help me as they have in the past.

Thanks Much
Matt@Launchnet

--
Please take a look at www.openoursite.com Click on: "Keywords" and then
Click on "Matt's Story" and if you are a man, you should be very happy that
you read my story. God Bless for everyones help.

Message posted via http://www.officekb.com