admin 管理员组文章数量: 1086019
I wrote a vba that takes data from the spreadsheet and creates a .txt file with it. Later i prompt the user to ask if the filed should be viewed. I wanted to give the option of Notepad as well as Notepad++ but with Notepad++ there is a problem.
Just in case I will add that I use to open the file.
EditorFP = Cells(8, 39).Value
If Left(EditorFP, 2) = "1." Then
EditorFP = Replace(EditorFP, "1. Notepad ~ ", "") & " " & Addr & FileN
ElseIf Left(EditorFP, 2) = "2." Then
EditorFP = Replace(EditorFP, "2. Notepad++ ~ ", "") & " " & Addr & FileN
Else
End If
If MsgBox("Open with Notepad++?", vbYesNo) = vbYes Then
Call Shell(EditorFP, vbNormalFocus)
End If
The value of the variable EditorFP = C:\Program Files\Notepad++\notepad++.exe C:\Users\ 'User Name' \ 'Filename'.txt
When it tries to open the .txt file I first get the message:
"C\Users\ 'Name ~ (Just first name)'" doesn't exist. Create it?<
Followed with the next message:
"C\Users\ 'Name ~ (full name)'\OneDrive - 'CompanyName'\ 'Documents'\ 'lastname'\ 'Filename'.txt" cannot be opened: Folder "C\Users\ 'Name ~ (full name)'\OneDrive - 'CompanyName'\ 'Documents'\ 'lastname'" doesn't exist.<
Just to be clear. There is no space between \ and ' I just added it because without it, the post looked wierd in the preview (the \ disappeared).
本文标签: Problem Opening Textfile throught VBA Shell NotepadStack Overflow
版权声明:本文标题:Problem Opening Textfile throught VBA Shell Notepad++ - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/p/1744099121a2533415.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论