通过VBA用记事本打开文件 [英] Open a file with notepad through VBA

查看:576
本文介绍了通过VBA用记事本打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用记事本打开文件.

I am trying to open a file with notepad.

const strfilename = "C:\Users\Desktop\abc.txt"

set OFS = myOFSO.OpenTextFile(strfilename) 

正在显示

错误代码424

error code 424

推荐答案

只需调用一个shell命令即可执行带文件路径的notepad.exe.

Could just call a shell command to execute notepad.exe with the file path.

returnvalue = Shell("notepad.exe " & strfilename, vbNormalFocus)

这篇关于通过VBA用记事本打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆