Export to WORD in IE Browser



Twanny
07-09-2005, 11:24 PM
Right-Clicking a NewsGroup item brings up a Menu which, amongst other things,
lists "Export to Microsoft Excel" (bottom part).
Can this menu be edited in the Registry to include MS Word? (XP Pro SP2).
It would be great to export part of a post to WORD: it does not seem to work
in Excel.
--
Rgds
"Twanny"

David Candy
07-09-2005, 11:24 PM
<SCRIPT language=VBScript>

DIM xlApp

This is a script embedded in Excel that supplies the functionality. You can copy it to a html file and edit it to work with word. Then duplicate the menu entry specified here

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\E&xport to Microsoft Excel. Use file:// not res://



DIM xlWorkBook

ON ERROR RESUME NEXT

'Set IE variables and get the URL

SET ieParentWin = external.menuArguments

ieSrcURL = ieParentWin.location.href

fTableSel = FALSE

SET ieSrcElem = ieParentWin.event.srcElement

IF ERR = 0 AND UCASE(ieParentWin.document.selection.type) = "NONE" THEN

tagName = UCASE(ieSrcElem.tagName)

DO UNTIL tagName = "TABLE" OR tagName = "BODY"

SET ieSrcElem = ieSrcElem.parentElement

tagName = UCASE(ieSrcElem.tagName)

LOOP

IF tagName = "TABLE" THEN

tagParentName = tagName

SET ieParent = ieSrcElem

DO UNTIL tagParentName = "BODY" OR tagParentName = "VIEW"

SET ieParent = ieParent.parentElement

tagParentName = UCASE(ieParent.tagName)

LOOP


IF tagParentName <> "VIEW" THEN

fTableSel = TRUE

IF ieSrcElem.ID <> "" THEN

ieSrcConnect = ieSrcElem.ID

ELSE

SET ieTables = ieParentWin.document.all.tags("table")

ieSrcConnect = 1

FOR EACH ieTable IN ieTables

IF ieTable.sourceIndex = ieSrcElem.sourceIndex THEN

EXIT FOR

END IF

ieSrcConnect = ieSrcConnect + 1

NEXT

END IF

END IF

END IF

END IF

SET xlApp = CreateObject("Excel.Application")

ON ERROR GOTO 0

SET xlWorkbook = xlApp.Workbooks.Add

ON ERROR RESUME NEXT

xlApp.Visible = True

IF fTableSel THEN

webQuerySourceHRef = ieSrcElem.getAttribute("o:WebQuerySourceHRef")

IF webQuerySourceHRef <> "" THEN

SET xlQueryTable = xlWorkbook.Worksheets(1).QueryTables.Add("URL;" & webQuerySourceHRef, xlWorkbook.WorkSheets(1).Cells(1,1))

xlQueryTable.EditWebPage = ieSrcURL

ELSE

SET xlQueryTable = xlWorkbook.Worksheets(1).QueryTables.Add("URL;" & ieSrcURL, xlWorkbook.WorkSheets(1).Cells(1,1))

xlQueryTable.EditWebPage = ""

END IF

xlQueryTable.FieldNames = True

xlQueryTable.RowNumbers = False

xlQueryTable.FillAdjacentFormulas = False

xlQueryTable.PreserveFormatting = True

xlQueryTable.RefreshOnFileOpen = False

xlQueryTable.BackgroundQuery = True

xlQueryTable.RefreshStyle = 0 'xlOverwriteCells

xlQueryTable.SavePassword = False

xlQueryTable.SaveData = True

xlQueryTable.AdjustColumnWidth = True

xlQueryTable.RefreshPeriod = 0

xlQueryTable.WebSelectionType = 3 'xlSpecifiedTables

xlQueryTable.WebFormatting = 3 'xlWebFormattingNone

xlQueryTable.WebTables = ieSrcConnect

xlQueryTable.WebPreFormattedTextToColumns = True

xlQueryTable.WebConsecutiveDelimitersAsOne = True

xlQueryTable.WebSingleBlockTextImport = False

xlQueryTable.WebDisableDateRecognition = False

xlQueryTable.WebDisableRedirections = False

xlQueryTable.Refresh

ELSE

xlApp.Dialogs(667).Show ieSrcURL

END IF

</Script>




--
----------------------------------------------------------

"Twanny" <Evenstar@Fastweb.net> wrote in message news:8EDA8034-F350-40B2-A3B3-A88186605556@microsoft.com...
> Right-Clicking a NewsGroup item brings up a Menu which, amongst other things,
> lists "Export to Microsoft Excel" (bottom part).
> Can this menu be edited in the Registry to include MS Word? (XP Pro SP2).
> It would be great to export part of a post to WORD: it does not seem to work
> in Excel.
> --
> Rgds
> "Twanny"

Anthony
07-09-2005, 11:25 PM
I will try David, but this is too technical for me: perhaps my son can help
me with it.
Thanks for your input.

Twanny
---------------------------

"David Candy" wrote:

> <SCRIPT language=VBScript>
>
> DIM xlApp
>
> This is a script embedded in Excel that supplies the functionality. You can copy it to a html file and edit it to work with word. Then duplicate the menu entry specified here
>
> HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\E&xport to Microsoft Excel. Use file:// not res://
>
>
>
> DIM xlWorkBook
>
> ON ERROR RESUME NEXT
>
> 'Set IE variables and get the URL
>
> SET ieParentWin = external.menuArguments
>
> ieSrcURL = ieParentWin.location.href
>
> fTableSel = FALSE
>
> SET ieSrcElem = ieParentWin.event.srcElement
>
> IF ERR = 0 AND UCASE(ieParentWin.document.selection.type) = "NONE" THEN
>
> tagName = UCASE(ieSrcElem.tagName)
>
> DO UNTIL tagName = "TABLE" OR tagName = "BODY"
>
> SET ieSrcElem = ieSrcElem.parentElement
>
> tagName = UCASE(ieSrcElem.tagName)
>
> LOOP
>
> IF tagName = "TABLE" THEN
>
> tagParentName = tagName
>
> SET ieParent = ieSrcElem
>
> DO UNTIL tagParentName = "BODY" OR tagParentName = "VIEW"
>
> SET ieParent = ieParent.parentElement
>
> tagParentName = UCASE(ieParent.tagName)
>
> LOOP
>
>
> IF tagParentName <> "VIEW" THEN
>
> fTableSel = TRUE
>
> IF ieSrcElem.ID <> "" THEN
>
> ieSrcConnect = ieSrcElem.ID
>
> ELSE
>
> SET ieTables = ieParentWin.document.all.tags("table")
>
> ieSrcConnect = 1
>
> FOR EACH ieTable IN ieTables
>
> IF ieTable.sourceIndex = ieSrcElem.sourceIndex THEN
>
> EXIT FOR
>
> END IF
>
> ieSrcConnect = ieSrcConnect + 1
>
> NEXT
>
> END IF
>
> END IF
>
> END IF
>
> END IF
>
> SET xlApp = CreateObject("Excel.Application")
>
> ON ERROR GOTO 0
>
> SET xlWorkbook = xlApp.Workbooks.Add
>
> ON ERROR RESUME NEXT
>
> xlApp.Visible = True
>
> IF fTableSel THEN
>
> webQuerySourceHRef = ieSrcElem.getAttribute("o:WebQuerySourceHRef")
>
> IF webQuerySourceHRef <> "" THEN
>
> SET xlQueryTable = xlWorkbook.Worksheets(1).QueryTables.Add("URL;" & webQuerySourceHRef, xlWorkbook.WorkSheets(1).Cells(1,1))
>
> xlQueryTable.EditWebPage = ieSrcURL
>
> ELSE
>
> SET xlQueryTable = xlWorkbook.Worksheets(1).QueryTables.Add("URL;" & ieSrcURL, xlWorkbook.WorkSheets(1).Cells(1,1))
>
> xlQueryTable.EditWebPage = ""
>
> END IF
>
> xlQueryTable.FieldNames = True
>
> xlQueryTable.RowNumbers = False
>
> xlQueryTable.FillAdjacentFormulas = False
>
> xlQueryTable.PreserveFormatting = True
>
> xlQueryTable.RefreshOnFileOpen = False
>
> xlQueryTable.BackgroundQuery = True
>
> xlQueryTable.RefreshStyle = 0 'xlOverwriteCells
>
> xlQueryTable.SavePassword = False
>
> xlQueryTable.SaveData = True
>
> xlQueryTable.AdjustColumnWidth = True
>
> xlQueryTable.RefreshPeriod = 0
>
> xlQueryTable.WebSelectionType = 3 'xlSpecifiedTables
>
> xlQueryTable.WebFormatting = 3 'xlWebFormattingNone
>
> xlQueryTable.WebTables = ieSrcConnect
>
> xlQueryTable.WebPreFormattedTextToColumns = True
>
> xlQueryTable.WebConsecutiveDelimitersAsOne = True
>
> xlQueryTable.WebSingleBlockTextImport = False
>
> xlQueryTable.WebDisableDateRecognition = False
>
> xlQueryTable.WebDisableRedirections = False
>
> xlQueryTable.Refresh
>
> ELSE
>
> xlApp.Dialogs(667).Show ieSrcURL
>
> END IF
>
> </Script>
>
>
>
>
> --
> ----------------------------------------------------------
>
> "Twanny" <Evenstar@Fastweb.net> wrote in message news:8EDA8034-F350-40B2-A3B3-A88186605556@microsoft.com...
> > Right-Clicking a NewsGroup item brings up a Menu which, amongst other things,
> > lists "Export to Microsoft Excel" (bottom part).
> > Can this menu be edited in the Registry to include MS Word? (XP Pro SP2).
> > It would be great to export part of a post to WORD: it does not seem to work
> > in Excel.
> > --
> > Rgds
> > "Twanny"
>


Export to WORD in IE Browser