Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to export the value of a text box to excel

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!

1 Solution

Accepted Solutions
m_woolf
Master II
Master II

Here's the really obvious reply:

The line copying your text box is commented out.

Also, the API guide says:

ActiveDocument.GetSheetObject("TX01").CopyTextToClipboard

View solution in original post

3 Replies
m_woolf
Master II
Master II

Here's the really obvious reply:

The line copying your text box is commented out.

Also, the API guide says:

ActiveDocument.GetSheetObject("TX01").CopyTextToClipboard

Not applicable
Author

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?

m_woolf
Master II
Master II

The API Guide is included in the Documentation