Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Button Open Network Path (file)

Status
Not open for further replies.

Neondog82

Programmer
Sep 11, 2006
3
US
Hello all. I have been searching for a while trying to find a way to have a command button clicked and to open a txt file from a network share. I seem to understand half the concepts for the VBA code but I am just missing a certain piece. Can someone please help me write the code to open a txt file from a network path? Thank you so much for your time.
 
Dhookom, thank you so much. Is it possible to put a variable in the string?

Here is my psuedo code for what I am doing:

FName As String
FName = "Bob"
FilePath As String
FilePath = "\\NETWORKPATH\FName.txt"

trying to open bob.txt
 
The code I provided did open a file name stored in a string variable.
Code:
  Dim FName As String
  FName = "Bob"
  Dim FilePath As String
  FilePath = "\\NETWORKPATH\" & FName & ".txt"
  FollowHyperlink FilePath

Duane
Hook'D on Access
MS Access MVP
 

Another way you may try is to open text file in Notepad:
Code:
Dim lngRetVal As Long
strFile = "\\NETWORKPATH\FName.txt"[blue]
lngRetVal = Shell("NOTEPAD.EXE " & strFile, 1)[/blue]

Have fun.

---- Andy
 
Again, thank you so much. I really appreciate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top