Hi Guys
This may seem painfully easy but its cuasing me some grief. I created a button that opens a word document on my server automatically. Code below.
Private Sub Command1_Click()
Dim oApp As Object
Dim oDoc As Object
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
Set oDoc = oApp.Documents.Open("\\Csc-server\Common\CSC\Contact Management\CSC CONTACT MANAGEMENT SYSTEM MANUAL - FINAL.doc")
End Sub
This works very well indeed. But what I am now trying to do is use a similar button to open an excel worksheet in the same folder on the server with the code below.
Private Sub Command2_Click()
Dim oApp As Object
Dim oDoc As Object
Set oApp = CreateObject("Excel.Application")
oApp.Visible = True
Set oDoc = oApp.Documents.Open("\\Csc-server\Common\CSC\Contact Management\CSCContactPhonebookContentsPage-RSversion.xls")
End Sub
Problem is it is coming back with a error message. "Run-time error 438, Object doesnt support this property or method" and highlights the path to the document.
Is there something I have missed or done that I need to do differently for an excel sheet as opposed to a word doc. The excel sheet opens up fine, just the document doesnt show.
Hope you can help.
Thanks in advance.
Tones
This may seem painfully easy but its cuasing me some grief. I created a button that opens a word document on my server automatically. Code below.
Private Sub Command1_Click()
Dim oApp As Object
Dim oDoc As Object
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
Set oDoc = oApp.Documents.Open("\\Csc-server\Common\CSC\Contact Management\CSC CONTACT MANAGEMENT SYSTEM MANUAL - FINAL.doc")
End Sub
This works very well indeed. But what I am now trying to do is use a similar button to open an excel worksheet in the same folder on the server with the code below.
Private Sub Command2_Click()
Dim oApp As Object
Dim oDoc As Object
Set oApp = CreateObject("Excel.Application")
oApp.Visible = True
Set oDoc = oApp.Documents.Open("\\Csc-server\Common\CSC\Contact Management\CSCContactPhonebookContentsPage-RSversion.xls")
End Sub
Problem is it is coming back with a error message. "Run-time error 438, Object doesnt support this property or method" and highlights the path to the document.
Is there something I have missed or done that I need to do differently for an excel sheet as opposed to a word doc. The excel sheet opens up fine, just the document doesnt show.
Hope you can help.
Thanks in advance.
Tones