询问-打印方法错误.代码有什么问题?帮我.请 [英] ASK - Printing method error. What's wrong with the code? Help me. please

查看:53
本文介绍了询问-打印方法错误.代码有什么问题?帮我.请的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个使用VB6的项目.在第一个项目中,我使用以下代码,它可以完美运行

I have two projects using VB6 each. In the first project I use the following code and it works perfectly

Dim PRN As Object
Set PRN = Printer
    PRN.FontBold = True
    PRN.CurrentX = 800: PRN.CurrentY = 1100
    PRN.FontSize = "10": PRN.Font = "Arial"
    PRN.Print "Your account is : " & strAccount 'Variable for user' account
    PRN.EndDoc



第二个项目与第一个项目几乎相同.我很困惑,因为它会导致错误消息:编译错误.找不到方法或数据成员
这是代码



The second project is almost the same as the first project. I''m so confused for it results an error message : Compile Error.. Method or data member not found
Here is the code

Dim P As Object
Set P = Printer
        P.FontSize = 11
        P.Font = "Arial"
        P.CurrentY = 1000: .CurrentX = 1000
        P.Print "Note: " & sNota 'Variable for Note
        P.EndDoc



这两个代码在不同的项目中.我试图在互联网上找到答案,但是我失败了.有人可以帮我吗?



These two codes are in different project. I''ve tried to find the answer in the internet but I failed. Can anybody help me?

推荐答案

尝试删除& sNota"部分,看看它是否可以编译-可能是您拼错了它! >
或者,在".CurrentX"前面添加"P":
Try taking the "& sNota" part off and see if it compiles - it may be that you have misspelled it!

Alternatively, add a "P" in front of ".CurrentX":
P.CurrentY = 1000: .CurrentX = 1000

成为

P.CurrentY = 1000: P.CurrentX = 1000




[edit]只注意到"P"缺少了一点... [/edit]




[edit]Only noticed the "P" missing a bit late...[/edit]


以下代码正在工作.

The following code is working.

Printer.Font = "Arial": Printer.FontSize = 11
Printer.CurrentX = 1000: Printer.CurrentY = 1000
Printer.Print "Note " & sNota



那么,这是问题吗?



So, is this the problem?

Dim P As Object
Set P = Printer


这篇关于询问-打印方法错误.代码有什么问题?帮我.请的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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