473,769 Members | 5,173 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need YOUR PROFESSIONAL HELP to Import Word Document in MS Access Tables

6 New Member
Hello,

My problem is that I receive different Word Documents as attachments

and I need to get its data into the corresponding tables in access.


I have used Text Form Fields in Word Document and could save it in text format

and imported it in ms access, but this way takes long time.

So, I need your help to have a command button that when clicked I get a

browse window that enables me to choose the Word Documents (.doc Only) I want to import.

And as I have different Word Documents, I think I will need different command

buttons for each Word Document as each would be knowing which table to

import to.

Also is there anyway to minimize the possibility of importing a Document to the wrong table?

Is it possible to make the access import all documents saved in a specific folder to a specific table? I know this is fiction

Thank YOU and I really Trust Your Abilities in Solving my problem.

And I Really Appreciate your HELP
Oct 1 '08 #1
4 2198
ADezii
8,834 Recognized Expert Expert
The following Code Template, using only a single Command Button, will:
  1. Open a File Dialog Box which will only allow you to select either a single, or multiple, Word Documents.
  2. Process each File(s) selected, and then cross reference it/them against hard coded File Names.
  3. Take appropriate action (Append to proper Table) depending on the File(s) selected.
  4. If a File(s) is/are not on the List, display an Error Message to the User that it/they cannot be Imported.
  5. I intentionally omitted Comments in order to reduce the length of the code, but should you have any questions, please feel free to ask
Expand|Select|Wrap|Line Numbers
  1. 'Must set a Reference to the Microsoft Office XX.X Object Library
  2. Dim fdg As FileDialog
  3. Dim vrtSelectedItem As Variant
  4. Dim strSelectedFile As String
  5.  
  6. Set fdg = Application.FileDialog(msoFileDialogFilePicker)
  7.  
  8. With fdg
  9.   .AllowMultiSelect = True         'allow multiple Files to be selected
  10.   .Filters.Clear
  11.   .Filters.Add "Word Documents", "*.doc"
  12.   .FilterIndex = 1
  13.   .InitialView = msoFileDialogViewDetails
  14.     If .Show = -1 Then
  15.       For Each vrtSelectedItem In .SelectedItems
  16.         'Retrieve 'FileName only'
  17.         strSelectedFile = Right$(vrtSelectedItem, Len(vrtSelectedItem) - InStrRev(vrtSelectedItem, "\"))
  18.           Select Case strSelectedFile
  19.             Case "Some File 1.doc"
  20.               'code specific to Some File 1.doc
  21.             Case "Some File 2.doc"
  22.               'code specific to Some File 2.doc
  23.             Case "Some File 3.doc"
  24.               'code specific to Some File 3.doc
  25.             Case "Some File 4.doc"
  26.               'code specific to Some File 4.doc
  27.             Case "Some File 5.doc"
  28.               'code specific to Some File 5.doc
  29.             Case "Some File 6.doc"
  30.               'code specific to Some File 6.doc
  31.             Case "Some File 7.doc"
  32.               'code specific to Some File 7.doc
  33.             Case "Some File 8.doc"
  34.               'code specific to Some File 8.doc
  35.             Case "Some File 9.doc"
  36.               'code specific to Some File 9.doc
  37.             Case "Some File 10.doc"
  38.               'code specific to Some File 10.doc
  39.             Case Else
  40.               MsgBox "[" & strSelectedFile & "] cannot be Imported!", vbExclamation, "Import Failed"
  41.           End Select
  42.       Next vrtSelectedItem
  43.     Else 'The user pressed Cancel.
  44.     End If
  45. End With
P.S. - Be sure to set a Reference to the Microsoft Office XX.X Object Library
Oct 1 '08 #2
acc2ess
6 New Member
Thank You ADezii,

but I have only one more thing to add which is that the file names I receive are

not static as some dates and numbers would be added to the original file name.

and I think this what causes the problem with the code

Thanks ALOT
Oct 1 '08 #3
ADezii
8,834 Recognized Expert Expert
Thank You ADezii,

but I have only one more thing to add which is that the file names I receive are

not static as some dates and numbers would be added to the original file name.

and I think this what causes the problem with the code

Thanks ALOT
The code can be modified to accommodate 'Unique', 'Original' File Names. A simple example of what I am referring to would be if a Base File Name was Financial Report. The code can be modified to accept: Third Quarter Financial Report, Financial Report for the Fiscal Year 2008, Projected Financial Report for 2010, etc. Let me know if you are interested, and if you have Unique, Base/Original File Names.
Oct 1 '08 #4
acc2ess
6 New Member
Hello ADezii,

infact the name of the document should be written exactly in the code so that I

would be able to import it and if there is any change in the name of the file the

code gives an error that it can't import it it..

anyway even I made the table name with same name of the file and the import

apparently finishes successfully,th en I don't find any data entered in the table.
Oct 1 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

41
6138
by: Ruby Tuesday | last post by:
Hi, I was wondering if expert can give me some lite to convert my word table into access database. Note: within each cell of my word table(s), some has multi-line data in it. In addition, there is one row containing picture(s) as well. So far, what I did is doing it manually for each word docs I have. Select Table Convert Table to Text(I use ^ character for delimiter)
3
5208
by: svdh2 | last post by:
I have been looking at a problem the entire week in access, I have still not been able to find a solution. Hope that you could maybe tell where to look Concerns the link between Access and Word. I can not transfer a report to word without losing out on the lay-out (RTF format). I understand that there is no way out ok, mail merge I thought. But here I have the problem that I need to merge multiple tables and that I can just include...
1
2419
by: Srini | last post by:
Hi, I am trying to import an xml file which has more than 255 fields. Access is unable to import the xml file into tables and gives the error message "Too many fields defined." in ImportErrors column. I was wondering is there any solution to fix the problem. Please reply.
10
3060
by: Neil | last post by:
An article at http://news.com.com/2100-1012-991694.html?tag=fd_top states: "XML would allow easier interchange of data generated in Office documents with back-end systems or existing Web services." As part of an Access 2000 application, I have to continually parse Word documents and store the parsings in Access tables using Automation to control Word and parse the document. Is there a way that XML would help with that? Thanks.
2
13533
by: Mikey | last post by:
Sample VB .NET source code to create mailing labels or customized letters using MS Word MailMerge This VB .NET source code will start MS Word and call methods and set properties in MS Word to execute a MailMerge to create mailing labels or customized letters. A label name known to MS Word MailMerge mailing label wizard may be used or a template file containing the field names Line1 thru Line5 for each record to be printed. If a...
2
4084
by: a.crowley | last post by:
I have a large set of Word documents that I wish to catalogue in an Access database. Each document has a set of file properties populated (title, subject, author, keywords, comments ect), so I'd like to import those into an Access table for processing. I've written VBS macros in the past to import data from Excel sheets into Access tables, but the same functionality does not appear to be available for Word. Any clues or sample code...
20
4284
by: mike | last post by:
I help manage a large web site, one that has over 600 html pages... It's a reference site for ham radio folks and as an example, one page indexes over 1.8 gb of on-line PDF documents. The site is structured as an upside-down tree, and (if I remember correctly) never more than 4 levels. The site basically grew (like the creeping black blob) ... all the pages were created in Notepad over the last
1
7864
by: =?ISO-8859-1?Q?S=F8ren?= | last post by:
Hi guys I got the following code: ------------------------------------------------------- Dim Word As New Microsoft.Office.Interop.Word.Application Dim Document As Microsoft.Office.Interop.Word.Document Document = Word.Documents.Open(Filename)
0
5281
by: shivapadma | last post by:
i want to know how multiple tables are added to the MS word document using vb.net i wrote following code to insert one table in MS word document using vb.net 1.opened MS word document 2.inserted one 3x3 table Dim App As New Word.Application() Dim Doc As Word.Document = App.Documents.Add() Dim oTable1 As Word.Table Dim Range As Word.Range
0
10049
jinu1996
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...
0
9865
tracyyun
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...
1
7413
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5309
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...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3965
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 we have to send another system
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.