Opening Word Problem
Nov 11, 2005
I have cobbled together some code to open a Word template that is a merge doc associated with a query.
The code has a syntax error and I'm not sure what' wrong:
Private Sub Command0_Click()
Set objword = CreateObject("Word.application")
With objword
.Visible = True
.Documents.Open S:\Information ServicesRecords ManagementFOILettersTEM-SL1FOIAcknowledgement-v101.dot
End Sub
Anybody any ideas?
Thanks in advance
View Replies
ADVERTISEMENT
Aug 31, 2005
Is it possible to open a Microsoft Word FILE using a macro(or even a query??)? I know how to open Word itself using a Macro by Selecting the Run App Command and typing in my Word address e.g C:Word.exe . I have tried opening a word file using C:filename.doc but no success, the address is correct as I've successfully opened it using Start, Run
Any help would be superb
Cheers All
View 1 Replies
View Related
Jun 9, 2006
Hi all,
Sorry but I'm really new to Access and trying to make sense of all the useful advice on here!
I'm trying to programme a button in one of my forms to open up a word document as read-only. I've written the code to open up the Word application (before I found the button which did it for me! :( ) but I think I need to add one or two more lines so that word knows where the document is I want and opens it up - any ideas what these lines are?
Real sorry for the trouble - any help would be most appreciated! Thanks guys and girls.
View 4 Replies
View Related
Mar 4, 2005
i have a word doc that is built by code. at the end, after the doc is completely built, i save the doc and kill my word object. what i want to do is be able to launch the doc automatically for the user, but still be able to kill the code object used to create the doc. what i currently have, which obviously doesn't open the doc, is as follows:
Code:wrd.ActiveDocument.SaveAs sOutputDir & sHeader & ".doc"wrd.ActiveDocument.Closewrd.QuitSet wrd = Nothing
i can't figure out how to get word to open with my doc. i'm sure i'm overlooking something simple, but does anyone have ideas for me on this?
View 1 Replies
View Related
Sep 7, 2005
I have searched this topic but can't find exactly what I'm looking for so I hope someone help.
I have a directory full of doc files which are constantly being updated. I would want to be able to browse the directory from Access and click on the relevant file to open it directly.
So there's no storing the pathnames in a table etc...just open the doc to view.
Any ideas?
Dave Eyley
View 4 Replies
View Related
Sep 14, 2006
I've used the Outputto method to archive reports creted in Access to Word in .rtf.
I now want to have an option to view these archives from Access. How?
Thanks,
Richard
View 2 Replies
View Related
Feb 27, 2008
As a basic user and relatively new user of Access, I have designed a database which holds the data for several word documents that I use for mailmerges. I want to be able from the "switchboard" link the word documents so that users can easily access the letter/form required and print them. Ive tried many things - just not working!!!! Time to shout for help!
View 1 Replies
View Related
Feb 4, 2005
I have a form with various details on clients. I have 6 different letters that need to pull off different fields from the client form. Is it possible to have a button (for each letter) that when when clicked will open up the word document for the specific client with the fields on their poulated, such as name, ammount owed etc.
Mail merge does not do the trick as it brings back all the clients in the database and not the specific one.
View 7 Replies
View Related
Jan 12, 2005
I have completed a form that I am ready to put into production. I want to include a couple help documents with the database. There are two word documents that are stored as OLE objects in a table. I normally wouldn't include OLE objects like this because I would want to keep the DB size down, but there should only be 2-3 small word documents
What needs to happen:
click a button on a form and have the correct word document open.
The tbl they are stored in is called tblAddins. Two columns thus far, named:
ID (autonumber primary key)
file (OLE)
The only thing that the wizard (wish i didn't need to use it) gives me for Word is to open the application itself.
Thanks in advance to the great minds of this forum for any help.
View 3 Replies
View Related
Feb 15, 2005
How is it possible to open a form letter word docment from an Access form in which information on the form (such as name and address) is used in the letter?
View 3 Replies
View Related
Aug 5, 2015
I would like to open a Word document using a button control on a form to a file path listed in a field on the form. I use the following code when I want to open a single specific document...
Dim wdApp As Word.Application, wdDoc As Word.Document
On Error Resume Next
Set wdApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then 'Word isn't already running
Set wdApp = CreateObject("Word.Application")
End If
On Error GoTo 0
Set wdDoc = wdApp.Documents.Open(File path here)
wdApp.Visible = True
...but in this case the file path I want to use will be designated by a field on the form. I know I could just use a hyperlink but I don't like the way it looks on the form. I would rather hide that field and have code pull that path when I hit the button.
So how would I change my code to make it so the value in the file path field on the form goes in where it says "File path here" in my code above?
View 2 Replies
View Related
Apr 11, 2013
How to match 4 character word or number or combination by identical 4 characters word or number or combination in one word have 10 or 15 characters.
I have to two separate tables (Table A and Table B). Table A has one column (Tag No) and Table B has about 15 columns with one column name Tag No as below
Table A
Table B
Tag No
Tag No
2009
ZZZ-2030-DC
2010
ZZZ-2010-M9P
[code]....
They're both in MS Access.I am trying to match 2 tables - columns (Tag No) with join query, but not success. I want to match 4 characters in Table-A with 4 similar characters in Table-B (Tag No) cell.What query is suitable to compare two tables.
View 8 Replies
View Related
Aug 14, 2014
My end goal is to populate a pre-existing table in an MS Word document with records from a query. The easiest way I've found (through scouring the internet) is to start with the code below (ran during OnClick() even in Access) to get the table the same size as the recordset:
Code:
Dim wDoc As Word.Document
Dim wTable As Word.Table
Dim wCell As Word.Cell
Set wDoc = appWord.Documents.Add(strDocLoc)
wDoc.Visible = True
[Code] ....
The code will shrink the table down just fine if the table has more rows than the recordset +1 (for header column). My hangup with this is the last line ("Selection.InsertRowsBelow 5") isn't executing; rows are not being added to the table. I get no errors -- it just does nothing. I set it as "Selection.InsertRowsBelow 5" arbitrarily just to see if it would even add rows, and sure enough it's not.
View 9 Replies
View Related
Apr 7, 2014
I have a Form opening from Access Options. I would like to close this Form using the Timer. The following is the code I have used but it is not working.
Private Sub Cover_Page_Form_Load()
OpenTimer = Timer
End Sub
Private Sub Cover_Page_Form_Timer()
If (Timer - OpenTime) = 5 Then DoCmd.Close acForm, "Cover_Page_Form", acSaveYes
End Sub
Next question. If I can get this to work can I then use a DoCmd to open new Form within the code above or do I need a new process.
View 5 Replies
View Related
Apr 20, 2006
Hi All,
Is there a way that when the user clicks on a database file, the form pops up without opening MS Access window.
Thx,
Jatz
View 1 Replies
View Related
Apr 20, 2006
Hi All,
Is there a way that when the user clicks on a database file, the form pops up without opening MS Access window.
Thx,
Jatz
View 6 Replies
View Related
Jun 11, 2007
I am very close to completing a DB Program.... How can I create a desktop Icon that will Launch my Program without Loading Microsoft Access along with it???
View 6 Replies
View Related
May 18, 2005
Hi,
I am exporting a table to word and I have come across a problem.
My code opens a template, creates a table with the correct number of rows and columns at a certain position, and then adds data to it.
At this point, everything is fine. But, here is where the problem sticks its ugly head out. I am modifying the column widths and every other time I run it, it crashes, saying something about not being able to access the remote server. Run time error 462.
I have checked in the task manager that word is being quit properly each time and tried going to different templates.
The first time I run it, it runs fine. The second time, it crashes on the line where I change the width. Here is the line of code.
mytable.Columns(1).Width = InchesToPoints(1.2)
I have found that if I close the document after it is created and leave word open, it will run fine.
I think I am in the same boat as mrpauly. But his post date is 23rd April 2001…
http://www.access-programmers.co.uk/forums/showthread.php?t=26363
Has anyone else seen or heard anything like this? I’m really confused…
Thanks for any help anyone can give.
View 1 Replies
View Related
Aug 15, 2007
Hello,
I made a database application and i need some help: in the application i use a script that modifies word documents by opening ms word application, but some customers don't want to install ms word. I'm asking if someone knows tto exist some kind of word runtime that i can modify word documents without having word installed. I'm using also vb6.
Thanks!!!!
View 1 Replies
View Related
Jul 11, 2005
and I want to write in some places
I know to open the word
and write in to the word
to write in to word:
Dim objWord As Word.Application
Set objWord = CreateObject("Word.Application")
objWord.Visible = False 'True is visible
objWord.Documents.Add ("C:DocumentsTest.dot")
objWord.ActiveDocument.Bookmarks("bmCusDetails").Select
objWord.Selection.Text = Forms![a]![b]
objWord.Visible = True
but how am I write in a special place?
thanks alot, and sorry on my english
View 1 Replies
View Related
Jul 22, 2005
Exporting datasheet to word, how is this possible using vb. Actually, I do have a thread in Form forum. But, I think not a lot of people visit that place. Anyways, I have created bookmarked and used datavariable to export the data (by ansentry's help). But the only thing that it exports is just one selection on that datasheet, instead of all the chosen rows.
I am exhausted now after searching everywhere, and not finding a clue. How to resolve that situation. If there is an example that I can use, that would be gr8.
Thanks In Adv.
View 2 Replies
View Related
Mar 26, 2006
Right the thing is i can export my reports to word but when they export they don't hold the lines that i placed around the text boxes, this is becoming quite annoying as the reason i put the lines around the boxes,was so when the report is output it looks like the original.
Help please!!
View 7 Replies
View Related
Apr 27, 2006
Im having a problem getting this code to work.
It is meant to fire up Word (which it does), open up a new doc based on the template (which it also does) and then populate a field in the doc with data from the query table (which it doesn't).
I've put the fields in the Word doc via firstly, defining them as Custom Document Properties in the File, Properties box, and then as "{ DOCPROPERTY "<fieldname>" *MERGEFORMAT }" codes in the text.
The field in the Word doc is type 'text' and the field in Access is type 'text', so I am stumped by the "Type Mismatch" error it gives when attempting to get/open the recordset.
It hasnt even got to transferring the values across to the doc.?
Ive not done this before (Access newbie) and even found creating the custom fields in Word not as straighforward as I expected!
Please can someone help?
Private Sub butDocPreview_Click()
Dim dbs As Database
Dim objDocs As Object
Dim objWord As Object
Dim prps As Object
Dim rst As Recordset
Dim strClient As String
Dim strAccountManager As String
On Error Resume Next
Set objWord = GetObject(, "Word.Application")
If Err.Number = 429 Then
'Word is not running; creating a Word object
Set objWord = CreateObject("Word.Application")
Err.Clear
End If
On Error GoTo cmdWord_ClickError
DoCmd.SetWarnings False
'Open query..
DoCmd.OpenQuery "qryClientDocHdr_Export"
intCount = DCount("*", "tmpClientDocHdr")
Debug.Print "Number of Text items: " & intCount
' Check that there is at least one line..
If intCount < 1 Then
MsgBox "No text to process; cancelling"
Exit Sub
End If
Set dbs = CurrentDb
'==stops here with "Type Mismatch" error==
Set rst = dbs.OpenRecordset("tmpClientDocHdr", dbOpenDynaset)
With rst
strClient = Nz(![Client])
strAccountManager = Nz(![AccountManager])
End With
rst.Close
...
...
...
View 3 Replies
View Related
Apr 13, 2007
To queries here:
Database is the MS Contacts Template with minor adjustments.
1. Trying to insert a link to an image using a bound OLE object in my form. Now I've got it top work. However, the link appears normal size in the centre of the object box. Problem is when I resize the oject box so that llink text just fits fine. The text resizes with the box and you need a microscope to read it.
2. I want to be able to cerate merged letter but I cant select Tools>Merge it with MS word fro some reason (i've aslo tried with with DB's we use in work with same problem) but publish with Word is available.:confused:
I am by no means an expert with Access so please, please post replies in lamens terms.
Thanks,
Marc
View 2 Replies
View Related
Jul 9, 2007
Hi,
This is my First post - so please be kind. I'm quite new at coding things and have learnt almost every thing from this forum so far by search old posts but can't find the answer to the below. I know how frustrating it must be to answer the same question over and over again so if this has been answered before please accept my appologies and if you could direct me to the old post I'll pick it up from there.
I have managed to get my DB to output to Excel using the below code:
Set Xl = CreateObject("Excel.Application")
Xl.Visible = True
Xl.Workbooks.Open ("C:TEMPPACLPACL - Blank") ',,True
Xl.range("C8").Value = [Text78]
Xl.range("C9").Value = [tender name]
Xl.range("C10").Value = [Request Number]
Xl.range("F10").Value = [Accepted offer]
Xl.range("C14").Value = [Site Status]
Xl.range("C16").Value = [Accepted offer SPO]
Xl.range("C17").Value = [Type]
Xl.range("C19").Value = [Mpan]
Xl.range("C20").Value = [HH MOP]
Xl.range("C32").Value = [Payment Terms]
Xl.range("C13").Value = [No of sites]
Xl.range("C4").Value = [Text173]
Xl.range("A47").Value = [Additional comments]
I now need to do the same for word;
I have managed:
Dim oApp As Object
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
oApp.Documents.Open ("C:TEMPQuatation") ',,True
but I have no idea how to get the info held in field [tender name] in my database into the Ln 5, col 10 in my word document.
I hope this makes sense, any help will be greatly received as I am very new at this and very eager to learn.
View 4 Replies
View Related
May 23, 2005
i've a question.
is there a way to associate a word document to a table entry?
i would like to create a database of microsoft word files where you can search for a certain keyword that is linked to a word document. is there a way to do this?
View 2 Replies
View Related