I am updating code that someone else wrote, in order to be drive independent. I am taking data from an access database and doing a mailmerge to word. The real problem is When the word template document is opened, it begins the attempt to mailmerge, but it gives me an error since the drive is assigned statically rather than by a network share.
What I need to do is reassign the mail merge to use a drive share, instead of a letter. I am sort of unfamiliar with word. There are no events (I thought it might be under document open firing) in visual basic, So it must be some setting in word. As well, since it fires on document opening, I assume that as well must be a setting. Thanks for any advice.
Related
I have a pretty good project task management system going in Microsoft Access, but one feature I'm still missing is some type of 'quick entry' like facility often found in many good productivity applications.
This is how it would work:
Scenario 1:
You're in another application, working on a few things, and you just remember something that needs to get done. You hit your predefined shortcut: CTRL + ALT + T (again, from outside Microsoft Access) and it brings up a small access form with a text box in to which you can type what needs to get done, e.g.
Inform key stakeholders of concerns regarding timeline
you hit return and that gets saved as a record in Microsoft Access instantly.
An alternative, and slightly more complex scenario...
Scenario 2:
As above, but you want to add further details besides the task name, such as the person you need to speak to, and a due date. The input in to the text box could look like this:
Inform #Sally of concerns regarding timeline >+3
Where '#' tells access to populate a field called 'Contact' with 'Sally' (unless it already exists) and '>+3' is interpreted by access to mean a due date 3 days from today.
How difficult are Scenario 1 and Scenario 2 to perform? What level of VBA/programming knowledge would be required?
Thanks,
I would say it requires a fair amount of confidence in VBA.
You need to register a global hot-key; that is, a keyboard-combination that can be captured from outside the Access application. It requires win-api calls. Here is some code.
You need to know where to place these calls. I believe you have to put them in a standard module, not in the form's class module. (I haven't double-checked this, it's late.)
You need to have a little understanding about what this code is doing. NEVER attempt to type this api-code - copy it from a reliable source, exactly as it is!! You don't need to fully understand the code, but you need to know how (and when) to call each function.
Once you've registered the hot-key then your VBA needs to bring your application to the front and display your form, and focus it. Reliably bringing the application to the front may also require api-calls.
Once your form is opened (and focused) you can have a button on it to parse the information in its textbox. However, if you are designing the form anyway, I would add checkboxes, comboboxes, etc., rather than trying to parse a complex sentence/ statement.
I'm developing a small project, using Access, SQL, Word and PowerPoint, the goal of this project ist too allow the user, to add is personal information, in Access, throught user forms, register that information in the SQL database, and passe it to templates in Word and PowerPoint.
The templates are loaded and the dynamic data in them, filled, when pressing a button (word or powerpoint) in an access form.
So, with word, it's all working well through the use of bookmarks, but in powerpoint, things get tricky, there are no bookmarks (damn you Microsoft).
So i've been searching SO and Google, but cant seem to find a example that works for me. All of the examples talk about creating a new powerpoint presentation, that is not want i'm looking for.
The goal is just to add the dynamic data, in this case textboxes and a photo, and leave the static data in the template.
So the flow would be something like this
SQL (database) -> ACCESS (user interface) -> Word and Power Point (Final Template).
If anyone has an example of how just to start this i would be very gratefull for your help.
Thank you all for your time in this matter.
I'm not clear on what the problem is exactly. Do you need to know how to start a new presentation based on your existing template? If so, you'd open your template file as though it were a presentation then immediately save it AS a presentation (rather than starting a new presentation and applying the template, which will give you only the design but none of the contents .. the slides ... of the template file).
I also don't understand why you'd expect all applications, Word, Excel, PowerPoint and the rest, to be identical. If Word did everything that PowerPoint does, there'd be no need for one or the other of them. It stands to reason that they'll have different feature sets, as appropriate to their usage.
In any case, to add, say, user name as needed throughout a presentation, it's quite quick to look at each shape to see if it contains text, and if so, to replace, say %%USERNAME%% with the actual user name you're working with.
You can similarly look for special text, say PICTURE:portrait, within a shape and if found, insert a picture, size it to match the shape then delete or hide the original shape.
I am working with a small company who is slowly moving to MS access. Currently all their reports live in multiple MS Word documents. During this transition they need to not only keep the word documents up to date, but also feed the information into the database. (Basically remove the need to double enter data).
Is there a way that I can write one global macro that can be ran on any word document, or do I need to carry over this macro to each individual document?
Yes, you can use one global macro. You can place this macro in the user's normal.dot or put it in another document. I suggest using another document because it is easier to "deploy" to multiple users. This document is placed in one of Word's "startup" locations. What you are doing is creating an "add-in".
Word Add-ins at
http://msdn.microsoft.com/en-us/library/aa189710(office.10).aspx.
"You can add functionality to a
Microsoft® Word solution by creating a
Word-specific add-in (also sometimes
referred to as a global template)."
Office 2007 has some wonderful ways to make transfer the semantic meanings of these reports to a more specific type of data that will fit easier into a database using XML and schemas. If you want to learn more about this, go watch "Module 05 Custom XML" at http://msdn.microsoft.com/en-us/office/bb738430.aspx Specificly the part about distributing a schema to people to allow them to "mark up" these word documents (it's really easy) so there will be less of a burden on you to import all this stuff.
I have a report reading records out of a DMS system and I thought it would be nice to have a link to the documents that it is listing so that the users could view the actual documents.
However when it displays a Word doc it allows you to make changes and then save them, which rather undermines the DMS system.
I don't think there is a parameter (/r) in Word that does this so do any of you clever people out there have a solution please?
Here is a link to the command line switches in Word 2007. There does not appear to be such an option as you describe. The /r switch re-registers Word in the registry and closes. Probably the best way to do this is download the Word Viewer and use it to open the document rather than Word itself.
If you have the option to write a small web component, write a component that takes an ID and streams out the document, then link to that service from the report. The web server will make a local copy of the document for reading.
Of course, then users will be frustrated that their changes are going into a black hole, but it sounds like that may be a better problem to have.
There's a better answer for those using Sharepoint
I am working on a project converting a "spreadsheet application" to a database solution. A macro was written that takes screen shots of each page and pastes them into a PowerPoint presentation. Because of the nice formatting options in Excel, the presentation looks very pretty.
The problem I'm having is that I haven't ever seen an Access report that would be pretty enough to display to upper management. I think the output still has to be a PowerPoint presentation. It needs to look as close as possible to the original output.
I am currently trying to write some code to use a .pot (presentation template) and fill in the data programmatically. Putting the data into a PowerPoint table has been tricky because the tables are not easy to manipulate. For example, if a particular description is too long, I need to break into the next cell down (word-wrap isn't allowed because I can only have n lines per page).
Is there a way to make an Access report pretty, am I headed down the right path, or should I just try to programmatically fill in the Excel spreadsheet and use the code that already exists there to produce the presentation? (I'd still need to figure out how to know when to break a line when using a non-monospaced font, as the users are currently doing that manually when they enter the data in the spreadsheet)
Jason Z:
If I set it to wrap, and I already have n lines, it would make n+1 or 2 lines on the slide, which is unacceptable.
Dennis:
That article looks very good, I should be able to glean something from it. Thanks!
Access has the capability to create downright beautiful reports. The problem is that it can't make a spreadsheet look better than Excel. You have to know when to use each tool.
Use Excel when you have spreadsheet-like formatting, need a lot of boxes and lines, or want to draw charts.
Use Access when you will output a report as a PDF. It's very useful for one-record-per-page detail reports, formatting where you need to position things very precisely, and where you need to embed subreports with related or unrelated data.
Think about the reports that would be nasty in Excel because you'd have to merge cells all over the place and do funny things with the placement and the layout would never work. That's where Access shines.
Joel, (your co-host here) did a thing about using access reports for shipping labels a few years back... maybe this could be a inspriation for you?
http://www.joelonsoftware.com/articles/HowToShipAnything.html
I have implemented Access reports which were 'pretty' enough. The downside is that it takes a lot of time and effort, and trial and error to produce the desired output.
You can definitely get there, but it requires the patience of a saint.
I guess it depends on what you mean by pretty. For example, I do not find it particularly difficult to produce say, reasonable graphs and tables with alternate line shading in Access. It is also possible to use MS Word and fill in bookmarks, or mail merge. If the present system uses VBA to create the PowerPoint presentation, perhaps much of it could be transferred to Access? Microsoft have an article on Access to Powerpoint: http://msdn.microsoft.com/en-us/library/aa159920(office.11).aspx
Finally, it is not impossible to build HTML output from Access.
We create multi-colored, conditionally formated, reports that are printed for the partner meeting each month of a publically traded corporation. They're real pretty.
I would suggest that the problem you're having is because the requirement to replicate the old method identically is an incredibly bad idea.
You're not using Excel any more.
You're using a different tool with different capabilities.
Thus, you will use different methods to get results.
Re-evaluate the original requirements to see if they still make sense (e.g., exactly why is PowerPoint involved at all? Can PowerPoint import from the Access report snapshot viewer? Can PowerPoint import from a PDF produced from an Access report?), or if they are too connected to the old tools, and then determine what is important and what isn't, and only then should you start designing your solution.
I personally would not try to re-invent the wheel here. If you already have an Excel sheet that has the formatting you want, just export the data from Access into Excel for the report. Now, if you didn't have the original Excel sheet to begin with, that would be a completely different story.
As for breaking lines with non-monospaced fonts, have you tried setting the cell format to wrap?
It sounds like the path of least resistance is to fill in the Excel spreadsheet. We have a contractor who does our Access stuff, and for the more complicated reports he uses Excel. I guess complicated == hard to make look good.
Rather than filling in the excel spreadsheet programmatically, you may want to use the external data features of Excel and Access. Generally I put a query on each tab, which of course may be hidden. An "update all" causes all the queries to be updated. Then summary tabs show the pretty results from all the individual queries.
For one particularly complex system, a bit of excel vba programmatically changed a query and then walked through the tabs updating each one.
Finally, rather than doing screen shots, Excel has a "copy cells as a image" copy that populates the copy buffer with a resizeable image. This could give you better looking results than a pure screenshot since a screenshot can have various deficiencies depending on pixel density.
Just an update:
After a few hours of work, I was able to get a nice report out of Access (almost an exact copy of the excel version). It wasn't as difficult as I thought, I just had to figure the correct mixture of out subreports and pagebreaks.
Working with the wordwrap features of Excel/Powerpoint were a dead end because there could only be a set number of lines per page, period; plus I was too lazy to nail down all the pagination with VBA code issues myself. Like Shelley says, Access shines at report generation.
The output ended up being a PDF (Using Adobe Acrobat Professional). The problem I have left is getting select pages of said PDF into Powerpoint without Powerpoint antialiasing the results for me and making the resulting slide's text fuzzy. I found a couple of articles on converting .snp output to .wmf, which sounds like the way to go on that front.