LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Make this paste_into_word code flexible to unknown office/word version 97?

Hi,

I need to paste ranges and charts in to a new word file but don't know what
the user have.



From the enclosed code, I try to figure out how to make it flexible to
unknown 97 office users. I don't want to force any to go into VBE and
change objcet library etc. There must be a way - without access the
registry, that is to advanced for me - to paste charts and ranges to a new
word file.



Any suggestions?



/Regards



Sub ChartToDocument2()
'Here we use early binding and therefore we need to set
'a reference to MS Word Object Library x.x via the Tools | Reference...
'in the VB-editor.

Dim WDApp As Word.Application
Dim WDDoc As Word.Document

Set Word6 = CreateObject("Word.Basic")
With Word6
..AppRestore
..AppMaximize 1
..FileNewDefault
..InsertPara
End With

' Reference existing instance of Word
Set WDApp = GetObject(, "Word.Application.10")
' Reference active document
Set WDDoc = WDApp.ActiveDocument
' Reference active slide

For Each wWsht In ThisWorkbook.Worksheets
For Each sShape In wWsht.Shapes
sShape.CopyPicture
WDApp.Selection.PasteSpecial Link:=False, _
DataType:=wdPasteMetafilePicture, _
Placement:=wdInLine, DisplayAsIcon:=False
Next sShape
Next wWsht
End Sub






Sub Excel_Range_Word()
'Here we use early binding which means that a
'reference must be set to MS Word Object Library x.x
'via Tools |Reference in the VB-editor
Dim wbBook As Workbook
Dim wsSheet As Worksheet
Dim rnReport As Range
Dim wdApp As Word.Application
Dim wdDoc As Word.Document
Dim BMRange As Word.Range
Dim oShape As Word.InlineShape

Set wbBook = ThisWorkbook
Set wsSheet = wbBook.Worksheets("Sheet")

With wsSheet
Set rnReport = .Range("Rapport")
End With




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Make the row limit of excel flexible -not fixed at 65536. quadfan Excel Discussion (Misc queries) 1 December 1st 05 02:10 AM
Can I make formulas more flexible? George Excel Discussion (Misc queries) 3 November 8th 05 05:38 PM
How to make a flexible cell reference? Mar Vernooy Excel Discussion (Misc queries) 2 July 1st 05 01:33 PM
Code Glitch from version to version Shawn Excel Programming 2 November 24th 04 02:45 AM
Office automation application which will work with any version of office C#.NET Silly Programmer Excel Programming 1 February 21st 04 10:54 AM


All times are GMT +1. The time now is 04:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"