Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create and print report from Excel 1

Status
Not open for further replies.

llb1

MIS
Jul 17, 2004
1
US
I would like to create a few reports that I will create and launch from Excel VBA. These reports would be similar to the one I could create and print if I was using Ms Access.
- First is it possible to use VBA in Excel?
- Second is there any sample or link that I could see?
Thanks in advance.
Louis
 
Louis,
VBA was first put to use in Excel 5, and has been Excel's macro language ever since. It didn't come to Access until much, much later.

You can create "reports" in Excel by printing a portion (or the entirety) of a worksheet, moving data to a new worksheet, filtering or sorting data on an existing worksheet, running SQL or ADO database inquiries, etc.

Rather than write a book about all the possibilities, perhaps you could describe what you are starting with and the desired results.
 
Hi,
I am working on a project tah will retrieve info from an external server (VMS Database). When the data is loaded in the Excel spreasheet, I will do some specific calculations.
I do the above very often, therefore it should be OK.

For this project I will also need to retrieve some information and generate reports from the data. For example a report showing me all the sales for a specific salesperson.

I am not familiar with any reporting possibility in Excel and I was wondering if it is worth the time to do it in Excel or just do all using MS Access.
Thanks.
Louis
 
Louis,
I suggest you take a look at the Pivot Tables capability of Excel. This is excellent for slicing and dicing data. A good starting point is Chip Pearson's web page
You can create and manipulate the Pivot Tables object using VBA. If you can produce what you want manually, then try recording a macro to automate the process.

Excel will record a lot of "extra" steps when it records macros, so it is always advisable to hand-tune the resulting code. I often use the recording feature to identify the required objects & properties, as well as to define correct syntax.
Brad
 
any way to invoke the print dialog

the best I can find is
Excel.XlBuiltInDialog.xlDialogPrinterSetup which is a property
 
Cresby, you can use:
Code:
Sub test()
Application.Dialogs(xlDialogPrint).Show
End Sub
 
Thanks - I will go try. I don't have VBA help at work! Not that it got me that close at home.
 
update - if you type in the line it offers parameters which get a good explanation in VBA help - eg you can define the file name and it will fill the filename box ready for the user. The help file expands on all the dialogs but strangely (office 2000) does not include the hyperlink dialog

viz
Application.Dialogs(xlDialogPrint).Show filename
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top