Click here to Skip to main content
15,904,288 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two projects using VB6 each. In the first project I use the following code and it works perfectly
VB
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

VB
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?
Posted
Comments
OriginalGriff 7-Jul-11 12:18pm    
Answer updated

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
Becomes
P.CurrentY = 1000: P.CurrentX = 1000



[edit]Only noticed the "P" missing a bit late...[/edit]
 
Share this answer
 
v2
Comments
adadero 7-Jul-11 12:25pm    
I have tried that and still error. I've tried to change P to PRN as shown in the first project and still error. It should result no error, isn't it?
fjdiewornncalwe 7-Jul-11 12:32pm    
Definitely the first thing to try. (The missing P)... +5
adadero 7-Jul-11 12:43pm    
The following code is working.

Collapse

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


So, is this the problem?
Collapse

Dim P As Object
Set P = Printer
The following code is working.

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


So, is this the problem?
VB
Dim P As Object
Set P = Printer
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900