Help with extraction of specific information to excel using VBA

hataka911

New member
Joined
Jul 6, 2018
Messages
2
Reaction score
0
Points
0
Excel Version(s)
2013
Hi, i am quite new to VBA programming in general. I want to extract certain information indicated in the excel file from a application form into excel. But i am struggling to do it in a certain format.

I have included 2 sample files, whereby i need to extract certain information and input them into each row in excel. Any help or tips Would be greatly appreciated.

Thank you,
 

Attachments

  • Sample.docx
    22.8 KB · Views: 16
  • Import Data.xlsx
    9.7 KB · Views: 11
What have you tried so far? I have checked your examples and there isn't any evidence of anything you have attempted, however, it's true to say that you will have a great deal of trouble recovering the data you want due to the format and layout of your form, the smart move would be to recreate the application form in Excel.
 
Thank you Simon for the reply and suggestion. I actually got it work by using content control in Word. This is what i have.

Sub GetDataFromWordFile()


Dim wrd As Word.Application
Dim file As Word.Document

wdFileName = Application.GetOpenFilename("Word files (*.docx),*.docx", , _
"Browse for file containing table to be imported")


On Error Resume Next
Set file = GetObject(wdFileName)
On Error GoTo 0
Range("A2") = file.ContentControls(1).Range.Text
Range("B2") = file.ContentControls(3).Range.Text
Range("C2") = file.ContentControls(4).Range.Text
Range("D2") = file.ContentControls(5).Range.Text
Range("E2") = file.ContentControls(6).Range.Text
Range("F2") = file.ContentControls(7).Range.Text
Range("G2") = file.ContentControls(8).Range.Text
Range("H2") = file.ContentControls(9).Range.Text
Range("I2") = file.ContentControls(10).Range.Text
Range("J2") = file.ContentControls(11).Range.Text
Range("K2") = file.ContentControls(12).Range.Text
Range("L2") = file.ContentControls(13).Range.Text
Range("M2") = file.ContentControls(14).Range.Text
Rows(2).Insert shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove

file.Close
 
Hi
please wrap your code with code tags ( click Go advanced - select the code and click the # button) - Thanks
 
Back
Top