Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, struggling with this. Lets say I have a formula in a text object and its displaying a value. I want to export the sheet to excel using a button/macro. Any ideas how I can do this?
So far I have something like this:
Sub Excel_Extract()
Set XLApp = CreateObject("Excel.Application")
'Hide the workbook for now...
XLApp.Visible = FALSE
Set XLDoc = XLApp.Workbooks.Add
'Create a new sheet called 'Benefits'...
XLDoc.Sheets.Add.Name= "Benefits"
set obj = ActiveDocument.GetSheetObject("TX01")
AND HERE IS WHERE I HAVE MY PROBLEM....
'ActiveDocument.GetSheetObject("TX01").Copy true
XLDoc.Sheets("Benefits").Range("A1").Select
XLDoc.Sheets("Benefits").Paste
* I am just not sure how to assign that value to the excel cell A1. And with this code, all it does is insert Benefits to the cell and completely ignores the copy of TX01, so that tells me I am doing something wrong.
'Delete sheets 1-3. . .
XLDoc.Application.DisplayAlerts = False
XLDoc.Sheets("Sheet1").Delete
XLDoc.Sheets("Sheet2").Delete
XLDoc.Sheets("Sheet3").Delete
XLDoc.Application.DisplayAlerts = True
'Now show the workbook:
XLApp.Visible = TRUE
End Sub
Thanks for your help!
Here's the really obvious reply:
The line copying your text box is commented out.
Also, the API guide says:
ActiveDocument.GetSheetObject("TX01").CopyTextToClipboard
Here's the really obvious reply:
The line copying your text box is commented out.
Also, the API guide says:
ActiveDocument.GetSheetObject("TX01").CopyTextToClipboard
Ah I didnt mean to have that commented out on my example, but thanks for the answer!! BTW where did you see the API guide?
The API Guide is included in the Documentation