Solved

in vb4 'printform '

Posted on 1998-06-06
13
321 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

747 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

12 Experts available now in Live!

Get 1:1 Help Now