Codeblue
06-23-2012, 10:48 AM
Hello
I want to export data from a ss onto a word doc. This code sort of works...
Dim AppWord As Object
Dim Wstmp As Worksheet
With Application
.ScreenUpdating = False
.EnableEvents = False
.DisplayAlerts = False
End With
Set AppWord = CreateObject("Word.Application")
AppWord.Visible = True
'Sheets("Sheet1").Range("A1:A10,J1:J10").Copy
Range("A1:A50,F1:F50").Copy
Set Wstmp = Worksheets.Add
Wstmp.Range("a1").PasteSpecial xlPasteAll
Wstmp.UsedRange.Copy
AppWord.Documents.Add
'AppWord.Selection.PasteSpecial DataType:=wdPasteDefault
AppWord.Selection.Paste
Application.CutCopyMode = False
Wstmp.Delete
Set Wstmp = Nothing
Set AppWord = Nothing
With Application
.ScreenUpdating = True
.EnableEvents = True
.DisplayAlerts = True
End With
' new --------
'On Error GoTo ErrorHandler
Selection.WholeStory
If Document1.ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type <> wdPrintView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
With Selection.PageSetup.TextColumns
.SetCount NumColumns:=1
.EvenlySpaced = False
.LineBetween = False
End With
but I am getting these blue dotted lines around my text on the word doc sort of a like a table. How can I get rid of these? Please see attached.
I want to export data from a ss onto a word doc. This code sort of works...
Dim AppWord As Object
Dim Wstmp As Worksheet
With Application
.ScreenUpdating = False
.EnableEvents = False
.DisplayAlerts = False
End With
Set AppWord = CreateObject("Word.Application")
AppWord.Visible = True
'Sheets("Sheet1").Range("A1:A10,J1:J10").Copy
Range("A1:A50,F1:F50").Copy
Set Wstmp = Worksheets.Add
Wstmp.Range("a1").PasteSpecial xlPasteAll
Wstmp.UsedRange.Copy
AppWord.Documents.Add
'AppWord.Selection.PasteSpecial DataType:=wdPasteDefault
AppWord.Selection.Paste
Application.CutCopyMode = False
Wstmp.Delete
Set Wstmp = Nothing
Set AppWord = Nothing
With Application
.ScreenUpdating = True
.EnableEvents = True
.DisplayAlerts = True
End With
' new --------
'On Error GoTo ErrorHandler
Selection.WholeStory
If Document1.ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type <> wdPrintView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
With Selection.PageSetup.TextColumns
.SetCount NumColumns:=1
.EvenlySpaced = False
.LineBetween = False
End With
but I am getting these blue dotted lines around my text on the word doc sort of a like a table. How can I get rid of these? Please see attached.