Docmd Question with Word and Excel

seenfresh

Well-known Member
Joined
Jul 12, 2006
Messages
1,141
I'm not sure where to post this question exactly, so I decided it's end result would be an Excel format

I have the following code of which I am stuck... I have reached the point where I have exported an Access Report to Word doc and now I would like to copy the contents of this Word doc...thus selection.wholestory and paste this into a new Excel workbook.... I cannot just export the Access Report to Excel because the format does not result in the same layout...

My main question/problem is how can I use selection.wholestory for the Word document and initialize a new Excel workbook and paste this clipboard contents into the new wb?

Code:
Private Sub SummaryByRangeOK_Click()
On Error GoTo Err_SummaryByRangeOK_Click

    Dim stDocName As String
    Dim sName As String
    Dim eName As String
     Dim myWB As Excel.Workbook
     
    stDocName = "Report By Range for Excel"
    DoCmd.OpenReport stDocName, acPreview
    
    
    sName = stDocName + ".doc"
    DoCmd.OutputTo acOutputReport, stDocName, acFormatRTF, sName, True
   Selection.WholeStory
   Selection.Copy
   
   
   eName = stDocName + ".xls"
Set myWB = eName

Any advice or help would be amazing!

Thanks in advance,
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,225,335
Messages
6,184,332
Members
453,227
Latest member
Slainte

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top