I need to make MS word visible..please help
By the way, I inserted "obj.visible=true" like this
__________________________________________________ ____________________________
Sub PasteTableToWord()
Dim obj As Object
Dim temp As String
'Activate the worksheet containing the range to be copied
Worksheets("bpv").Activate
'Select the range the of cells to be copied; update to match
'your data
'Range("b2:l34").Select
'Worksheets("EFSV").UsedRange.Select
Call MyUsedRange
'Call WorksheetLoop
'Format the selection
Selection.ColumnWidth = 6.35
With Selection.Font
.Name = "Arial"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
End With
'Copy the cells
Selection.Copy
'Create a word object.
Set obj = CreateObject("word.basic")
'Create a new file.
obj.filenew
'Paste the Microsoft Excel Spreadsheet object into Word
obj.EditPasteSpecial Link:=1, Class:="Excel.Sheet.5", _
DataType:="object", IconFilename:="", _
Caption:="Microsoft Excel Worksheet"
'Make MS Word visible
obj.Visible = True
'Save the file
obj.FileSaveAs Name:="RML EF Interop.doc"
'Close Word.
'Set obj = Nothing
'Return to Microsoft Excel. If this line is not used, the
focus
'may be set to another Windows Application
' AppActivate "Word.basic"
'Deselect the selected range
'Application.CutCopyMode = False
End Sub
|