将一个变量写入记事本 [英] Write a variable to Notepad

查看:107
本文介绍了将一个变量写入记事本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在尝试向记事本写出一个字符串变量数组。我

不能让SendKeys接受字符串变量只引用字面值

字符串。


我不想要写一个文件的麻烦

我不想写一份报告

我不想写一个表格


我的用户要求我将这个字符串变量数组写入记事本,

并且我将记事本打开。 (他们将复制这些字符串和

将它们粘贴到另一个应用程序中)


我尝试了三个引号然后变量,但是这不起作用


Dim strMyString As String''我只知道一个字符串

strMyString ="这是我要输出到记事本的字符串"


''然后我打开记事本

SendKeys""" &安培; strMyString& """ ''这不起作用


啊......为什么这么简单如此坚硬


任何帮助都非常感激

Vmusic

解决方案

Vmusic写道:

啊啊。 ...为什么这么简单如此坚硬




因为它非常愚蠢?


这适合我:


Sub TestSendKeys()

Dim s As String

s ="愚蠢的事情要做的事。

SendKeys""" &安培; s& """

End Sub


Ju Chao博士

Dip Ed,BSci BCom,PHD


2006年3月17日21:21:45 -0800,Lyle Fairfield < LY *********** @ aim.com>写道:

Vmusic写道:

Ahhhh ....为什么这么简单SO HARD


<因为它是非常愚蠢的?




不,我经常发现一些愚蠢的事情很容易做到。


Hi,
I am trying to write out an array of string variables to Notepad. I
can''t get SendKeys to accept the string variable only literal quoted
strings.

I DO NOT want the hassle of writing to a file
I DO NOT want to write to a report
I DO NOT want to write to a form

My user requires I write this array of string variables out to Notepad,
and that I leave Notepad open. (They will be copying these strings and
pasting them into another application)

I tried three quotes and then the variable, but that didn''t work

Dim strMyString As String ''Just one string I know
strMyString = "This is a string I want to output to Notepad"

''Then I opened notepad
SendKeys """ & strMyString & """ ''This doesn''t work

Ahhhh.... Why is something so simple SO HARD

Any help is GREATLY appreciated
Vmusic

解决方案

Vmusic wrote:

Ahhhh.... Why is something so simple SO HARD



Because it''s incredibly stupid?


This works for me:

Sub TestSendKeys()
Dim s As String
s = "A dumb thing to do."
SendKeys """" & s & """"
End Sub

Dr Ju Chao
Dip Ed, BSci BCom, PHD


On 17 Mar 2006 21:21:45 -0800, "Lyle Fairfield" <ly***********@aim.com> wrote:

Vmusic wrote:

Ahhhh.... Why is something so simple SO HARD



Because it''s incredibly stupid?



No, some stupid things are quite easy to do as I have often discovered.


这篇关于将一个变量写入记事本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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