Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I open a file from a Network drive using Excel VBA?


I would like to open a file using excel vba from a network drive. Below
is the code that I have used to find the file. There are three separate
ways below that I have tried, but end up with nothing. The first set of
commands results in an error message of "Invalid Procedure call or
Argument". The second, my computer does not recognize the
FileSystemObject, and the third presents an error message of "Object
variable or With block not set". Any help would be greatly appreciated.


Private Sub CommandButton1_Click()

'ReturnValue = Shell("C:\Program Files\pipc\Procbook\Procbook.exe", 1)
'ReturnValue = Shell("Y:\Dropbox\bosnyak\Drywell Cooler Temperature PI
Trends\803A\T47DT2077.PDI", vbMaximizedFocus)

'Dim fso As FileSystemObject, fil As File
'Set fil = fso.getfile("Y:\Dropbox\bosnyak\Drywell Cooler Temperature
PI Trends\803A\T47DT2077.PDI")

'AppActivate ("PI - ProcessBook")
'Dim appX As PBObjLib.Application
'Set disY = appX.ProcBooks.Open(" Y:\Dropbox\bosnyak\Drywell Cooler
Temperature PI Trends\T47CT7364.PDI", pbPromptConvert)



End Sub


--
turnerje
------------------------------------------------------------------------
turnerje's Profile: http://www.excelforum.com/member.php...o&userid=25694
View this thread: http://www.excelforum.com/showthread...hreadid=392301

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default How do I open a file from a Network drive using Excel VBA?

With regard to the first set, I believe you need to specify an executable
for the Shell command. So your second statement would be the cause.

For the second set, you will need a reference to the Microsoft Scripting
Runtime of which the FileSystemObject is a part. You will also need to use
the NEW keyword when dimensioning the fso variable. For example:

Dim fso As New FileSystemObject, fil As File

For the third set, I believe that the PBObjLib.Application variable also
needs to be dimensioned with the NEW keyword.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


"turnerje" wrote in
message ...

I would like to open a file using excel vba from a network drive. Below
is the code that I have used to find the file. There are three separate
ways below that I have tried, but end up with nothing. The first set of
commands results in an error message of "Invalid Procedure call or
Argument". The second, my computer does not recognize the
FileSystemObject, and the third presents an error message of "Object
variable or With block not set". Any help would be greatly appreciated.


Private Sub CommandButton1_Click()

'ReturnValue = Shell("C:\Program Files\pipc\Procbook\Procbook.exe", 1)
'ReturnValue = Shell("Y:\Dropbox\bosnyak\Drywell Cooler Temperature PI
Trends\803A\T47DT2077.PDI", vbMaximizedFocus)

'Dim fso As FileSystemObject, fil As File
'Set fil = fso.getfile("Y:\Dropbox\bosnyak\Drywell Cooler Temperature
PI Trends\803A\T47DT2077.PDI")

'AppActivate ("PI - ProcessBook")
'Dim appX As PBObjLib.Application
'Set disY = appX.ProcBooks.Open(" Y:\Dropbox\bosnyak\Drywell Cooler
Temperature PI Trends\T47CT7364.PDI", pbPromptConvert)



End Sub


--
turnerje
------------------------------------------------------------------------
turnerje's Profile:
http://www.excelforum.com/member.php...o&userid=25694
View this thread: http://www.excelforum.com/showthread...hreadid=392301


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
Saving Excel File to a Network Drive Jason Excel Discussion (Misc queries) 2 March 2nd 10 05:16 PM
Excel can't open network drive! Meneos Excel Discussion (Misc queries) 3 September 5th 08 12:43 PM
excel 2003 file converted to .xlsm file when save to network drive Chris Excel Discussion (Misc queries) 3 January 23rd 08 02:56 PM
Can't open excel on network drive, it said somebody has opened it soe soe Excel Discussion (Misc queries) 1 December 1st 05 01:02 PM
Can't one excel file on network drive? Mesak Excel Discussion (Misc queries) 0 October 11th 05 09:58 AM


All times are GMT +1. The time now is 04:48 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"