Solved

in vb4 'printform '

Posted on 1998-06-06
13
323 Views
Last Modified: 2010-05-03
In vb4, I am trying to print the ENTIRE form to a standard 8 x 11 page on the printer. If the form that I am printing is in the MAX size, but NOT on the monitor (hidden with another form) , the printer ONLY reproduces the designated form in its NORMAL size.. thus, cutting of a great portion of the data on the form.  However , if the form is visible, the printer WILL reproduce ALL of  the data. How can I get the printer to print ALL of the form w/o having the form on the monitor?

Question #2. How do I get the data to FILL the 8x 11 page
so it looks more professional as upposed to only a half page and a LOT of empty space. In other words how do I streach the data and Fill the page?
0
Comment
Question by:hjaycox
  • 7
  • 5
13 Comments
 

Author Comment

by:hjaycox
ID: 1462692
Edited text of question
0
 
LVL 2

Expert Comment

by:evertd
ID: 1462693
It is not possible!
0
 

Author Comment

by:hjaycox
ID: 1462694
Nothing is impossible .there is an answer
0
 
LVL 9

Accepted Solution

by:
Dalin earned 200 total points
ID: 1462695
hjaycox,
Try this. If you have problems, let me know.
Regards
Dalin


Sub PrintMyForm()

myForm.Width =Printer.ScaleWidth
myForm.Height=Printer.ScaleHeight
myForm.PrintForm

End Sub()
0
 

Author Comment

by:hjaycox
ID: 1462696
Dalin:
I am stupid... need idiots clarification

myForm.Width =Printer.ScaleWidth
myForm.Height=Printer.ScaleHeight

What do I insert for the printer.scaleWidth and Printer.scaleheight? A # and if so what #. Or just the exact wording?  
0
 
LVL 9

Expert Comment

by:Dalin
ID: 1462697
hjaycox,
Don't feel bad. We all have things that we don't know. No one knows everything.

 Printer is a global object and scalewidth and scaleheight are two properties of the printer object. once your printer is set (in windowsor VB), these properties are available. You just putiiing the exact wording.
This will print the form in a full page. However, for some of the controls, its content can not be printed. Try this, if it does not do what you need, let me know.
Regards
Dalin
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:hjaycox
ID: 1462698
thanks you do GOOD WORK.  I Knew there was an answer
0
 
LVL 9

Expert Comment

by:Dalin
ID: 1462699
Thank you for the comments, hjaycox. I am glad it worked out.
Good luck in your project
Regards
Dalin

0
 

Author Comment

by:hjaycox
ID: 1462700
Is it possible to streach and fill to a 8 x 11 page  data from a visible form that, when printed to the printer only uses up 1/2 the printed page. This program is written in vb5. The above info that you gave works in vb4, but I get an error in vb5. Extra points to you on this one. ALSO see New question "Kill a COMMAND BUTTON "

0
 

Author Comment

by:hjaycox
ID: 1462701
Dalin here is a slam bang " IF exist" solution
on error goto 1
open "diR:\FILENAME.EXT" FOR INPUT AS #1
CLOSE #1
1 MSGBOX, " NO FILE EXISTS",,IB
0
 
LVL 9

Expert Comment

by:Dalin
ID: 1462702
hjaycox,
I just printed a copy of mine in VB5, it works OK.
The problems with this methods is that the content of some controls can not be printed. Another way is that you use the printer object and specify everything you want to print. However, this requires a considerable amount of code. If you are interested, email me at Dalin_N@Mailexcite.com.

The fileexisting solution you have here is incomplete.  If ta file exist but is open by another app, it will return an error when you try to open it, so you will get an answer of "not exist".

You can use the Dir function.

Dim lfile as String
lFile = Dir(yourFileWithPath)
If lFile = yourFile then
'     fileExist
   
Regards
Dalin


0
 

Author Comment

by:hjaycox
ID: 1462703
this slam is just to see if ythere is such a file.. not to open it with another app.

i will try the above and if Istill get an error ... will call back
thanks
seeyabye
0
 
LVL 9

Expert Comment

by:Dalin
ID: 1462704
hjaycox,
I guess I did not make myself clear.

Try this:
1. Open a file with notepad,
2. Run your code
3. you will get "File not exist", False!

Regards
Dalin

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB6 code to programmatically convert pdf to excel 21 70
Problem to skip loop 6 55
Reading the Contents of a Directory In Access VBA 5 59
Added a column screws up code 5 50
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now