Results 1 to 7 of 7
  1. #1
    New Lounger
    Join Date
    Feb 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Bulk Xfer of Word data to Excel

    Sub GET_DATA_WORDFILE()
    Dim sPath As String
    Dim sFile As String
    Dim MyWd As Object
    sPath = "C:\Documents and Settings\vanugula\Desktop\New Folder\"
    sFile = Dir(sPath & "*.doc")
    Do While sFile <> ""
    MyWd = GetObject(sPath & sFile)
    MyWd.ActiveWindow.Selection.WholeStory()
    MyWd.ActiveWindow.Selection.Copy()
    Sheets("Sheet1").Cells.SpecialCells(xlCellTypeLast Cell). _
    Offset(1, 1).End(xlToLeft).PasteSpecial(xlPasteValues)
    sFile = Dir()
    Loop
    MyWd = Nothing
    End Sub


    I am getting error in the sheet line..I need to copy 100+ word doc to 1 excel..but this code is generating errors..please anybody help me..(

  2. #2
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,820
    Thanks
    133
    Thanked 481 Times in 458 Posts
    Hi

    Make sure your are referring to the correct sheet name in YOUR excel file.
    If it isn't named Sheet1, the code won't work.

    For example, if your sheet is named wordData, then use:
    Sheets("wordData").Cells.SpecialCells(xlCellTypeLast Cell). _
    Offset(1, 1).End(xlToLeft).PasteSpecial(xlPasteValues)

    zeddy

  3. #3
    New Lounger
    Join Date
    Feb 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    zeedy!! please in detail

    thanks for the reply zeedy!
    i am unable to place the code at ryt place i think.in visual studios in vb i selected a web app and placed the code there..I am not able to understan frm where should i takethe sheets and sheet numbers..can you please make some-time and tell in details???

  4. #4
    New Lounger
    Join Date
    Feb 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sheets("Sheet1").Cells.SpecialCells(xlCellTypeLastCell). _
    Offset(1, 1).End(xlToLeft).PasteSpecial xlPasteValues

    in this i m getting error..from where should i add sheets to the program zeedy?? pleaseee help me for this i am new to programmg

  5. #5
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,820
    Thanks
    133
    Thanked 481 Times in 458 Posts
    Hi

    Try adapting the attached workbook.

    My example will also put the name of each Word Doc in bold red as it imports each of the word docs in a specified folder.

    zeddy
    Attached Files Attached Files

  6. #6
    New Lounger
    Join Date
    Feb 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hi zeddy!

    Brother I am sorry for the late reply..
    I got your attachment with an excel sheet and two buttons in it..Put whats eating my brain is how should i write a program in Visual Studio for the ..its a macro ryt? im lil new to programming can you please send me the complete code for that??
    Ill be very happy if you help me!. And ill wait for ur reply zeddy..Tc bye

  7. #7
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,820
    Thanks
    133
    Thanked 481 Times in 458 Posts
    Hi

    The VBA code is 'attached' to the buttons in the sample file.
    If you open the sample file sent previously you can check the VBA code in the VBA editor.
    Right-click on the button [import Word docs] in the sample file, then select Assign Macro from the menu that is displayed, then click the Edit button. This will open the VBA editor. Or click Alt-F11 to view the VBA editor.

    zeddy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •