July 18th, 2006, 15:24 PM
Open Notepad from Excel
Hello, new to this forum, but figured somebody here would be of help. I have written an Excel workbook and VBA file to manage inventory for the company I work for, I will be leaving this company in a few weeks and needed to leave some documentation/help files/how to on it so that the person who takes over my position can continue to use this file. So here's my question, I want to link to this file in my excel file (create a Command Button that when clicked will open this help file in Notepad). This help file is a .txt file, which I know I can open in excel but the formatting is shot when opened in Excel, does anyone know a way that VBA can open an external application like notepad? Thanks in advance. Ben
July 18th, 2006, 19:08 PM
The shell function should do it:
RetVal = Shell("C:\WINDOWS\notepad.exe", 1)
2nd argument is window style - look up shell in the Help file for details.
July 18th, 2006, 20:49 PM
Can I open a specific file say C:\myfile.txt in Notepad?
I tried Shell("C:\myfile.txt", 1) and it throws an error.
July 18th, 2006, 22:06 PM
I'd be more inclined to try something along the lines of:
RetVal = Shell("C:\WINDOWS\notepad.exe C:\myfile.txt", 1)
July 19th, 2006, 15:09 PM
Thanks, that did exactly what I wanted it to do.