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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Notepad

Status
Not open for further replies.

Informatic

Programmer
Oct 4, 2002
34
DE
Hi
How can I open a notepad File...
For example text.txt with VBA code in Access
 
Here ya go --

Public Sub OpenTextFile()
' Found in the helpfile in MSAccess
' In Microsoft Windows:
' Specifying 1 as the second argument opens the application in
' normal size and gives it the focus.

' Must specify Correct path of Notepad.exe
' and pass Path and filename of txt file to open.

Dim RetVal
RetVal = Shell("C:\WINNT\NOTEPAD.EXE D:\Filename.txt", 1) ' Run Text File

End Sub

Hope it helps.
 
Don't need the program's path as long as its class is in the registry (which notepad is):
Code:
  Dim retVal As Double
  
  retVal = shell("NotePad.exe ""C:\Boot.ini""", vbNormalFocus)
VBSlammer
redinvader3walking.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top