I am using an excel sheet to keep track of the finances of my afterschool program. Each week I am creating an invoice for the families that have a different balance, outputing from the excel file to a new word file. Everything works except I was wondering if it is possible to format the output within or before the Print # statement. Just typically word formatting things like size, font, underline and what not. If not, is there an alternative solution that I could use?
I am not entirely new to programming, but am new to VB. I have found answers to all of my other syntax type issues on the web or through the VB help, but had no luck with this problem.
Sample:
'Find the number of C sessions attended
a = Sheets(Week_of) .Range("P" & x).Value
'Print C Session # and associated cost
Print #1, a; " Session C (PM) @ $6.00"; Tab(40); "$"; a * 6
I would like to change the font size of the whole print statement as well as underline the a and a * 6 value.
Thanks for your help,
z
3 1887 QVeen72 1,445
Recognized Expert Top Contributor
Hi,
Are you Saving the values to a TextFile and then printing from there or directly Printing to the Printer...?
If using Second option, the "Printer" class has got all the Font Options.. -
Printer.FontName = "Courier New"
-
Printer.FontBold = True
-
Printer.Print "My First Doc"
-
Printer.FontBold = False
-
Printer.FontUnderline = True
-
Printer.Print "Second Line"
-
Printer.NewPage
-
Printer.EndDoc
-
Regards
Veena
I am currently writing to a text file (I want a copy saved for future reference) then printing that file. I also currently don't have a printer where I do most of my coding, so I need a file to test the formatting that will be created.
A couple of options come to mind.For instance... - Your VB code can drive Word directly, so in theory you could produce as fancy a report as you want.
- VB includes other ways to produce a "data report", which I don't have any experience with.
- This would be my preferred method. Add the Microsoft Rich TextBox Control to your project. Then you can throw your text into the RTB, select parts, format them how you want, then just save to an RTF file. Word will interpret RTF format, so it will come out the way you formatted it when loaded into Word. Make sure you save the file with extension ".RTF".
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: shoo |
last post by:
Any one know how to do this? thank
Write a simple text-formatting program that produces neatly printed
output from input text containing embedded command lines that
determine how to format the output; all lines begin with a period are
command lines. The task of the program is to collect words from input
lines, fill output lines with those words, adjust the margins, and
print the result. Your programs should handle the commands shown...
|
by: yoyo |
last post by:
Is there any way to make a select in DB2 to output in the following manner:
Attr1 value1
Attr2 value2
Attr3 value3
Attr4 value4
Instead of the
Attr1 Attr2 Attr3 Attr4
|
by: xtra |
last post by:
Hi Folk
I have written a module that allows you to type a bunch of commands in the
immediate window, for quick access to information when you are creating VB
code. Here it is, it may be helpful to you (I find it pretty fast and
friendly).... Some of it is specific to my database (I left out many as well
which were too specific), so you will have to rewrite it for yours, but you
may find it useful.... Any questions, please ask. Typing...
|
by: shoo |
last post by:
Any one know how to do this? thank
Write a simple text-formatting program that produces neatly printed
output from input text containing embedded command lines that
determine how to format the output; all lines begin with a period are
command lines. The task of the program is to collect words from input
lines, fill output lines with those words, adjust the margins, and
print the result. Your programs should handle the commands shown...
|
by: gburdell1 |
last post by:
When constructing a particularly long and complicated command to be
sent to the shell, I usually do something like this, to make the
command as easy as possible to follow:
commands.getoutput(
'mycommand -S %d -T %d ' % (s_switch, t_switch) +
'-f1 %s -f2 %s ' % (filename1, filename2) +
'%s' % (log_filename)
)
| |
by: tmp123 |
last post by:
Hello,
Thanks for your time.
We have very big files with python commands (more or less, 500000
commands each file).
It is possible to execute them command by command, like if the
commands was typed one after the other in a interactive session?
|
by: tcurdts |
last post by:
I think what I’m trying to do is very basic but I’m a rank beginner and I’m stuck. I’m using Python 2.4.1 on WindowsNT. I’ve installed UnxUtils, which includes the tar commands for Windows.
Immediate objective:
I have a text file containing a list of tar files, one filename per line. For now I’m just trying to loop through my text file and untar each file in the list.
Background/big picture:
Ultimately I’d like to
• Loop through...
|
by: raocheng |
last post by:
Please see the following code.
Suppose I have many shell commands to be executed. And I don't want to
fork a sub shell for each command(eg: status,output =
commands.getstatusoutput(cmd)) because it is too expensive. I want to
use only one sub shell to execute all these commands and want to get
each command's output. How can I accomplish this task ? Thanks in
advance.
===========================================
#!/usr/bin/env python
|
by: Tim |
last post by:
Folks,
I'm trying to format a print string so that it reports progress whilst
processing a looping structure with a date time stamp appended to the
end of the string. This started out life as a simple need to create a
display that show progress to users when updating large tables in a
data warehouse in real time.
I have subsequently address that need through a different method,
however I am challenged by the seeming impossibility to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |