Hello everyone, long time reader first time poster. I have a question that I can not currently find on my own.
I don't want to go into an overexplanation, but I need to be able to create a workbook that I does roughly the following things:
1) I have a very specific template that the sheets must follow. For example, There is a consistent header and footer the output must have, with a maximum of 15 rows per (printed) sheet. There are other tweaks I must do, but I believe I can handle that on my own. But essentially I need to be able to set individual cell properties, including values (in some cases the values need to be from the query) and row/collumn sizes/borders.
2) Groups rows by one of the collumn's values, and create an individual worksheet for each of these rows. This means that all 15 of the entries with a FieldX value of "apples" will be in the "apples" worksheet, and the 7 entries with a FieldX value of "pickles" will be in the "pickles" worksheet.
3) The worksheets need to be alphanumeric order so when they go to print they will print in order.
In the end I want to be able to have the user click an "output/print" button they can press. Doing so will take a Query/Table's information, and output it into one excel spreadsheet which fills in everything and they are able to print. This will save about 2 hours of gruntwork each time we need to print out a set, not to mention time saved when things need to be changed.
If you all need more information let me know. I will check back for replies ASAP. Thanks!
3 2038 nico5038 3,080
Recognized Expert Specialist
Hmm, will be a daunting task, as Access can't do this without VBA code.
Found this sample on the web: -
Function fncPopulateExcel() As String
-
-
Private Const XLT_LOCATION As String = "W:\Reports\Database\Request.xlt"
-
-
On Error GoTo Populate_Err
-
-
Dim db As Database
-
Dim qdf As QueryDef
-
Dim prm As Parameter
-
Dim rs As Recordset
-
Dim objXL As Object, objSheet As Object, objRange As Object
-
Dim strSaveAs As String, strRecord As String
-
Dim x As Integer, intRow As Integer
-
-
DoCmd.Hourglass True
-
Set db = CurrentDb()
-
-
' Open, and make visible the Excel Template (Request.xlt)
-
Set objXL = GetObject(XLT_LOCATION)
-
-
objXL.Application.Visible = True
-
objXL.Parent.Windows(1).Visible = True
-
-
' Open the recordset, and activate the sheet in the template
-
Set qdf = db.QueryDefs("qryRequest")
-
For Each prm In qdf.Parameters
-
prm.Value = Eval(prm.Name)
-
Next prm
-
-
Set rs = qdf.OpenRecordset(dbOpenSnapshot)
-
Set objSheet = objXL.Worksheets("TNSS")
-
objSheet.Activate
-
rs.MoveFirst
-
-
' Insert the data from the recordset into the worksheet
-
-
objXL.ActiveSheet.Cells(1, 5).Value = rs![Type]
-
-
objXL.ActiveSheet.Cells(3, 2).Value = rs![ProjectTitle]
-
-
' Set the save string, and save the spreadsheet. The file is saved with the project title as its name. (rs![ProjectTitle])
-
-
strSaveAs = "W:\Reports\TimingRequests\" & rs![ProjectTitle] & ".xls"
-
objXL.SaveCopyAs strSaveAs
-
PopulateExcel = strSaveAs
-
rs.Close
-
-
'Quit Excel
-
objXL.Application.Visible = True
-
objXL.Parent.Windows(1).Visible = True
-
objXL.Application.DisplayAlerts = False
-
objXL.Application.Quit
-
-
Set objXL = Nothing
-
Set objSheet = Nothing
-
Set objRange = Nothing
-
Set rs = Nothing
-
end Function
-
It gives the rough structure. You'll need to add an additional recordsource to loop through the sheets needed for the different fruits, but it's a start.
Let me know when and where you get stuck.
Nic;o)
NeoPa 32,556
Recognized Expert Moderator MVP
The code Nico posted uses these techniques, so you won't necessarily need this, but jic I thought I'd post the link ( Application Automation). It's fairly brief but does cover the fundamental concepts so may help you understand what's happening if you're new to it.
Thanks for the suggestion and sample. I figure I would have to work within VBA to do this, which I have no problem doing.
I will take a look at this when i get more free time.. probably this weekend or next. I will post an update when I get to the next stopping point.
Thanks again!
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Alan |
last post by:
Hi there,
Are there Excel charting gurus here?? If so then please read on...
Sorry for the cross-post but I'm not familiar with the Excel groups. I've
posted to asp.general because if I have...
|
by: Colleyville Alan |
last post by:
I have been working on an Access app that takes info from a file and writes
it to a spreadsheet on a form, simultaneously saving the spreadsheet to
Excel. I got the idea that the same concept...
|
by: someguy |
last post by:
Hi,
I'm trying to accomplish the following on a form on which i have
removed navigational buttons (I apologize in advance if this is too many
questions);
The two easy ones are....
1) When...
|
by: jquest |
last post by:
Hi;
I have a database that keeps track of customers and work done for them. Some
customers are repeat customers many times over, ie more than 100 records for
them.
I keep track of them in the...
|
by: Dixie |
last post by:
How do I, in VBA from an access form module, add 5 rows to the top of a
spreadsheet called MySpreadsheet.xls. The worksheet is called MyWorksheet
and there is already data in the first 5 rows. I...
| |
by: Gordon |
last post by:
Hello again,
Sorry to repost this request, but I'm under a bit of pressure to find a
quick solution.
All I basically want is an automatically updating link (OLE, not DDE)
between a control in...
|
by: Mitch |
last post by:
I am using Access to create an Excel spreadsheets with graphs related
to rows on the sheet1 to the graph on sheet2. I am using the same data
but different subsets of the data to make different...
|
by: sradoff |
last post by:
I wish to use XPath to access data from within an Excel generated XML Spreadsheet (generated with MS Excel 2003). I am using an asp Web page (not .NET, not at this time). I instantiate...
|
by: Widge |
last post by:
I have made a spreadsheet that will calculate the distance from a set of addresses to a specified postcode in Excel. I'm looking to move this to Access so I can start thinking about hooking it up to...
|
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...
|
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,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |