PDA

View Full Version : Help with CreateObject function



QAQ
08-29-2007, 01:20 PM
Hi all :),
I have two PCs on a network - one with windows vista and another with windows xp operating system. I dont know much about networks and all i know is that if i go to 'Network' on my windows vista taskbar - then i can see 'Netgear DG834GT Router' and 'Rashid-PC' (the pc with vista) and 'ROB-COMPUTER' (the pc with windows xp). I dont know how the network was setup but it has something to do with the modem (Netgear DG834GT Router) being connected to both PCs via wires (the router is used for connecting to the internet). When i open the ROB-COMPUTER from the Network window - all i see is the 'Printer' Icon, 'Printers' Icon, 'SharedDocs' Icon, C drive and D drive..

Im a coding in Excel 2007 and on the PC with windows vista. Basically I am trying the following code but its not working:


' Declare an object variable to hold the object
' reference. Dim as Object causes late binding.
Dim ExcelSheet As Object
Set ExcelSheet = CreateObject("Excel. Sheet", "ROB-COMPUTER")
' Make Excel visible through the Application object.
ExcelSheet.Application.Visible = True
' Place some text in the first cell of the sheet.
ExcelSheet.Application.Cells(1, 1).Value = "This is column A, row 1"
' Save the sheet to C:\test.xls directory.
ExcelSheet.SaveAs "C:\TEST.XLS"
' Close Excel with the Quit method on the Application object.
ExcelSheet.Application.Quit
' Release the object variable.
Set ExcelSheet = Nothing

I get the following error "Run-time error '462'. The remote server machine does not exist or is not available."

Can someone help please?

Many Thanks :biggrin:

Regards

Q