Open text file from Word VBA using Shell Command in Win 7
I want to open a text file using Notepad++ when a user presses a button on a user form.
The following worked fine in XP, but gives the error "file not found" under Windows 7. I cant find a simple answer on how to open a text file from VBA in Windows 7 . Can anybody help please? is the Shell command no longer valid in Win 7?
Private Sub Btn_Edit_Settings_Click()
dim striniFileName As String
FileName = "c:\Settings.txt"
Shell "C:\Program Files (x86)\Notepad++.exe" & FileName, vbMaximizedFocus
"I cant find a simple answer on how to open a text file from VBA in Windows 7 ."
"is the Shell command no longer valid in Win 7?"
Opening a file using VBA and Shell has not changed in Win 7.
Perhaps the issue is the location of Notepad ++.exe. File locations ARE different in Win 7, from XP...thus "file not found". Have you tried actually looking for it?