• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Open Text File From Desktop With Macro

I have this below and it works fine.

Shell "notepad.exe "C:usersanonymousdesktopexported-me.txt", vbMaximizedFocus


But this is specific to my pc only, and I was wanting something more versatile.

I need something like this but I keep having problems.


ThisWorkbook.Path & "Exported-Me.txt"


I keep getting errors?
 
Modify the following to suit

[pre]
Code:
Sub Test()
Dim t1 As String, t2 As String, t3 As String, t4 As String

t1 = "notepad.exe"
t2 = Application.ThisWorkbook.Path
t3 = "exported-me.txt"

t4 = t1 + " " + t2 + t3

Shell t4, vbMaximizedFocus
End Sub
[/pre]
 
Back
Top