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
4 2198 ADezii 8,834
Recognized Expert Expert
The following Code Template, using only a single Command Button, will: - Open a File Dialog Box which will only allow you to select either a single, or multiple, Word Documents.
- Process each File(s) selected, and then cross reference it/them against hard coded File Names.
- Take appropriate action (Append to proper Table) depending on the File(s) selected.
- If a File(s) is/are not on the List, display an Error Message to the User that it/they cannot be Imported.
- I intentionally omitted Comments in order to reduce the length of the code, but should you have any questions, please feel free to ask
- 'Must set a Reference to the Microsoft Office XX.X Object Library
-
Dim fdg As FileDialog
-
Dim vrtSelectedItem As Variant
-
Dim strSelectedFile As String
-
-
Set fdg = Application.FileDialog(msoFileDialogFilePicker)
-
-
With fdg
-
.AllowMultiSelect = True 'allow multiple Files to be selected
-
.Filters.Clear
-
.Filters.Add "Word Documents", "*.doc"
-
.FilterIndex = 1
-
.InitialView = msoFileDialogViewDetails
-
If .Show = -1 Then
-
For Each vrtSelectedItem In .SelectedItems
-
'Retrieve 'FileName only'
-
strSelectedFile = Right$(vrtSelectedItem, Len(vrtSelectedItem) - InStrRev(vrtSelectedItem, "\"))
-
Select Case strSelectedFile
-
Case "Some File 1.doc"
-
'code specific to Some File 1.doc
-
Case "Some File 2.doc"
-
'code specific to Some File 2.doc
-
Case "Some File 3.doc"
-
'code specific to Some File 3.doc
-
Case "Some File 4.doc"
-
'code specific to Some File 4.doc
-
Case "Some File 5.doc"
-
'code specific to Some File 5.doc
-
Case "Some File 6.doc"
-
'code specific to Some File 6.doc
-
Case "Some File 7.doc"
-
'code specific to Some File 7.doc
-
Case "Some File 8.doc"
-
'code specific to Some File 8.doc
-
Case "Some File 9.doc"
-
'code specific to Some File 9.doc
-
Case "Some File 10.doc"
-
'code specific to Some File 10.doc
-
Case Else
-
MsgBox "[" & strSelectedFile & "] cannot be Imported!", vbExclamation, "Import Failed"
-
End Select
-
Next vrtSelectedItem
-
Else 'The user pressed Cancel.
-
End If
-
End With
P.S. - Be sure to set a Reference to the Microsoft Office XX.X Object Library
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
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.
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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)
|
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...
|
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.
|
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.
|
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...
| |
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...
|
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
|
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)
|
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
|
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...
|
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...
| |
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...
|
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();...
|
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...
|
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 we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |