Friday, September 23, 2016

Copy from a Word Document and past it in excel, then save then close.

Copy from a Word Document and past it in excel, then save then close.

Hello from Steved "Office 2010"
I'm trying Copy from a Word Document and past it in excel, then save then close.
What is my problem please.
Yes I can do this by copying the word document and pasting it into excel by doing this, .Filters.Add "Workbooks", "*.xlsm", 1
The below is been highlited
        .Filters.Add "Workbooks", "C:\Racebase\DogStartTimes.xlsm.xlsx, 1"
Sub ToExcellAndPaste()
Dim xlapp As Object
Dim xlbook As Object
Dim xlsheet As Object
Dim i As Long, j As Long
Dim myrange As Range
Dim fd As FileDialog
Dim strFiletoOpen As String
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
    .Title = "Select the file into which the selected text is to be copied."
    .AllowMultiSelect = False
    .Filters.Add "Workbooks", "C:\Racebase\DogStartTimes.xlsm.xlsx, 1"
", 1
    If .Show = -1 Then
        strFiletoOpen = .SelectedItems(1)
    Else
        MsgBox "Cancelled by user."
    End If
End With
Set fd = Nothing
Selection.Range.ConvertToTable vbTab, Selection.Range.Paragraphs.Count, 2
On Error Resume Next
Set xlapp = GetObject(, "Excel.Application")
If Err Then
    bstartApp = True
    Set xlapp = CreateObject("Excel.Application")
End If
On Error GoTo 0
xlapp.Visible = True
Set xlbook = xlapp.Workbooks.Open(strFiletoOpen)
Set xlsheet = xlbook.Worksheets(1)
i = xlsheet.Range("A1").CurrentRegion.Rows.Count + 1
With ActiveDocument.Tables(1)
    For j = 1 To .Rows.Count
        For K = 1 To 2
            Set myrange = .Cell(j, K).Range
            myrange.End = myrange.End - 1
            xlsheet.Cells(i, K).Value = myrange
        Next K
        i = i + 1
    Next j
End With
xlbook.Activate
xlbook.Save
xlbook.Close
If bstartApp = True Then
    xlapp.Quit
End If
Set xlapp = Nothing
Set xlbook = Nothing
Set xlsheet = Nothing
End Sub

Keys to the Problem Copy from a Word Document and past it in excel, then save then close.

Download Error Fixer for Free Now

Use
Dim fd As FileDialog
Dim strFiletoOpen As String
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
    .Title = "Select the file into which the selected text is to be copied."
    .AllowMultiSelect = False
    .Filters.Clear
    .Filters.Add "Workbooks", "*.xlsx;*.xlsm"
    .InitialFileName = "C:\Racebase\DogStartTimes"
    If .Show = -1 Then
        strFiletoOpen = .SelectedItems(1)
    Else
        MsgBox "Cancelled by user."
    End If
End With
Set fd = Nothing
Assuming that DogStartTimes is a folder under C:\Racebase
-- Hope this helps.
Doug Robbins - Word MVP,
dkr[atsymbol]mvps[dot]org
Posted via the Community Bridge
"Steve8d" wrote in message news:*** Email address is removed for privacy ***...
Hello from Steved "Office 2010"
I'm trying Copy from a Word Document and past it in excel, then save then close.
What is my problem please.
Yes I can do this by copying the word document and pasting it into excel by doing this, .Filters.Add "Workbooks", "*.xlsm", 1
The below is been highlited
        .Filters.Add "Workbooks", "C:\Racebase\DogStartTimes.xlsm.xlsx, 1"
Sub ToExcellAndPaste()
Dim xlapp As Object
Dim xlbook As Object
Dim xlsheet As Object
Dim i As Long, j As Long
Dim myrange As Range
Dim fd As FileDialog
Dim strFiletoOpen As String
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
    .Title = "Select the file into which the selected text is to be copied."
    .AllowMultiSelect = False
    .Filters.Add "Workbooks", "C:\Racebase\DogStartTimes.xlsm.xlsx, 1"
", 1
    If .Show = -1 Then
        strFiletoOpen = .SelectedItems(1)
    Else
        MsgBox "Cancelled by user."
    End If
End With
Set fd = Nothing
Selection.Range.ConvertToTable vbTab, Selection.Range.Paragraphs.Count, 2
On Error Resume Next
Set xlapp = GetObject(, "Excel.Application")
If Err Then
    bstartApp = True
    Set xlapp = CreateObject("Excel.Application")
End If
On Error GoTo 0
xlapp.Visible = True
Set xlbook = xlapp.Workbooks.Open(strFiletoOpen)
Set xlsheet = xlbook.Worksheets(1)
i = xlsheet.Range("A1").CurrentRegion.Rows.Count + 1
With ActiveDocument.Tables(1)
    For j = 1 To .Rows.Count
        For K = 1 To 2
            Set myrange = .Cell(j, K).Range
            myrange.End = myrange.End - 1
            xlsheet.Cells(i, K).Value = myrange
        Next K
        i = i + 1
    Next j
End With
xlbook.Activate
xlbook.Save
xlbook.Close
If bstartApp = True Then
    xlapp.Quit
End If
Set xlapp = Nothing
Set xlbook = Nothing
Set xlsheet = Nothing
End Sub

Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org

Boot in Safe Mode:

  • Open Run command as previously described
  • Type MSConfig
  • Click on Boot tab
  • Tick Safe boot in Boot option
  • Select Network
  • Click Apply and OK
  • Reboot your system

Your system will boot in Safe mode with Networking. You may now try and open Windows Store and should not see any errors.

Recommended Method to Fix the Problem: Copy from a Word Document and past it in excel, then save then close.:

How to Fix Copy from a Word Document and past it in excel, then save then close. with SmartPCFixer?

1. Click the button to download Error Fixer . Install it on your computer.  Open it, and it will scan your system. The junk files will be shown in the scan result.

2. After the scan is finished, you can see the errors and problems need to be fixed. Click Fix All.

3. The Repair part is done, the speed of your computer will be much higher than before and the errors have been removed. You can also use other functions in SmartPCFixer. Like dll downloading, junk file cleaning and print spooler error repair.


Related: How Can You Update & Download NVidia 6100, 6800 GS/XT Display Driver v.260.89 WHQL,Where to Download NVidia GeForce 8800 GT WHQL-certified driver v.196.21,How to Update & Download NVidia GeForce Go 7400 Display Driver v.260.19.12,[Solved] Download NVidia GeForce GTX 460M Driver v.331.82,Download NVidia Quadro Plex Model IV VGA Driver v.304.43 Certified,Way to Download RealTek RTL8100C(L) Driver v.5.01,Way to Download RealTek RTL8100E Drivers v.694,Way to Update & Download RealTek RTL8101L Auto Installation Program v.6.110 driver,Method to Update & Download RealTek RTL8111G PXE and RPL ROM code v.2.58 driver,How to Update & Download RealTek RTL8411B(N) Driver v.10.003,Best Way to Update & Download ASUS A53SV nVidia Graphics Driver v.8.17.12.6686,Method to Herunterladen ASUS K75VJ Intel Rapid Storage Technology Treiber v.11.6.0.1030,How Can You Update & Download ASUS CG8580 Intel Chipset Driver v.9.3.0.1019,Method to Update & Download ASUS K41VD Intel INF Update Driver v.9.1.1.1015,Way to Update & Download ASUS Pro70T NB Probe v.3.0.0026 driver
Read More: Corrupted Recycle bins in Windows 7 Home Premium [Anwsered],How to Fix Problem - Corrupted template?,Could you please provide me the roadmap of Active Directory Application Mode software for 2012?,[Solved] cursor jumps around while typing,Created a test SYSTEM RESTORE point ... attempted restore ... FAILED Tech Support,Closing Internet Explorer causes error,Compare 2 Tables and Calculate the PROFIT Faster,Computer goes to Windows Boot Manager after Start,Connect to one of my network computer remotely when don't allow exception box Marked,computer locking up randomly

No comments:

Post a Comment