PatrickJohnson
Registered User.
- Local time
- Today, 07:12
- Joined
- Jan 26, 2007
- Messages
- 68
So i have an rtf file with some tables within it. There is also extraneous data. This file is generated from an application written by Quilogy and I have the task of taking this file and putting it through access to create a payroll file. There will generally be 3 to 4 lines of heading information, a couple blank lines, then a large table, with all this being repeated 3 to 8 times in a file.
My thought to get it into access tables works, but only by hand. I've run into considerable problems coding it. So here goes...
The process i figured out to get it from rtf to access is to:
1) open the rtf in word
2) copy all
3) open excel
4) paste with cursor at cell A1
This pastes the data in the table format
5) save the excel file
6) import the excel spreadsheet as a table into access
7) use delete and update queries to remove the extraneous lines and filter down to true data
So, I've gotten my vba code to open word, open the appropriate rtf file, copy all, then i'm stuck. I can't get excel to open and paste. here is the snippet I'm attempting to use:
I can get the save part after that i think, but this part won't work. i generally get the "workbook paste method failed" error, though the errors have changed from time to time.
basically what i'm after is either how to make this paste into the sheet so i can let the clipboard reformat or how to get the rtf file into access some other way. i tried saving it as text, and was successful, but when i open it all the table fields each start a new line and i can't get it not to.
My thought to get it into access tables works, but only by hand. I've run into considerable problems coding it. So here goes...
The process i figured out to get it from rtf to access is to:
1) open the rtf in word
2) copy all
3) open excel
4) paste with cursor at cell A1
This pastes the data in the table format
5) save the excel file
6) import the excel spreadsheet as a table into access
7) use delete and update queries to remove the extraneous lines and filter down to true data
So, I've gotten my vba code to open word, open the appropriate rtf file, copy all, then i'm stuck. I can't get excel to open and paste. here is the snippet I'm attempting to use:
Code:
Dim ExcApp As Excel.Application
Dim ExcBook As Excel.Workbook
Set ExcApp = New Excel.Application
With ExcApp
.Visible = True
Set ExcBook = ExcApp.Workbooks.Add
ExcApp.ActiveSheet.Paste
basically what i'm after is either how to make this paste into the sheet so i can let the clipboard reformat or how to get the rtf file into access some other way. i tried saving it as text, and was successful, but when i open it all the table fields each start a new line and i can't get it not to.