Word Pages to Excel Sheets

aequitas1903

Board Regular
Joined
Mar 8, 2012
Messages
127
Hello Everyone,

I am wondering if it is possible to use a macro to copy a word page to an excel sheet. For example word document has 45 pages, and when we start the macro, excel will have 45 sheets. It is not important for excel sheets to have the page numbers of word document.

I searched the forum but couldn't find an answer to my curiosity. I hope someone can direct or help me.

Another quick question: Is it possible to select the file by macro. When we press start, the macro will ask to select which word document to spread over excel sheets.

Please let me know if you have any questions.

Thank you for your interest.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

aequitas1903

Board Regular
Joined
Mar 8, 2012
Messages
127
Hi again,

I searched a little bit and try to figure out how can I do it and it goes like this.


I am trying to do an excel template to open a word file to copy pages to excel sheets but this word file is not static. It can be in a folder or on desktop. The user needs to select the document.

1- When excel is opened an auto_macro will start and force user to select a word document or I will insert a button to select the document. </SPAN>Is there a code to provide a pop-up window to let the user to select the document? Your precious knowledge needed :)

2- After the selection of the word file. Excel should open the word file and start to execute the code below which I find on the internet to select the current page, and edited to copy the current page and move to next page.

Code:
Sub SelectCurrentPage()</SPAN>
On Error Resume Next</SPAN></SPAN>
If Documents.Count > 0 Then</SPAN></SPAN>
ActiveDocument.Bookmarks("\page").Range.Select</SPAN></SPAN>
End If</SPAN></SPAN>
[COLOR=#00ff00][/COLOR]Selection.Copy              [COLOR=#00ff00]'I added this line[/COLOR]
Application.Browser.Next [COLOR=#00ff00]'I added this line[/COLOR]
End Sub</SPAN>

3- After 2nd step excel should create a new sheet to end and paste the copied data.

And I was thinking to use code below:

ThisWorkbook.Sheets.Add After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet</SPAN></SPAN>
Range("A1").Select
Selection.Paste

4- After this part I realised I should have a loop to copy all pages. Loop will be between 1 to "ActiveDocument.ComputeStatistics(wdStatisticPages)"

As you can see I am a bit confused :))

Any help will be appreciated. I will try to inform you if I figure out something

Thanks

</SPAN></SPAN></SPAN></SPAN>
</SPAN>
 

Forum statistics

Threads
1,171,652
Messages
5,876,705
Members
433,206
Latest member
james_y

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
Top