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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
kaicpa2
Contributor III
Contributor III

Write information on text object

Dear all

I have a little problem.

I am trying to wirte in a text object via macro the "last modified date" of one file

Despite all my effort I was not able to do it. I add below the code I used

Is it possible to do the above task directly in the script so as to have the above when I do the Reload

Thanks in advance for your help

Carlo Pazzaglia

Sub MyInfo
Dim FilePath,MyObjectFile
FilePath= "C:\Documents and Settings\KAICPA2\Desktop\My.qvd"
Set fso = CreateObject("Scripting.FileSystemObject")
set MyObjectFile= fso.GetFile (FilePath)
ActiveDocument.GetSheetObject( "TX08" ).GetText = MyObjectFile.DateLastModified
end sub


Labels (1)
1 Solution

Accepted Solutions
Not applicable

Hello Carlo

This won't work because you're trying to use GetText method to set text, try something like the following to replace your last line:


Set MyText = ActiveDocument.GetSheetObject("TX08")
prop = MyText.GetProperties
prop.Layout.Text.v = MyObjectFile.DateLastMadified
MyText.SetProperties prop


Note: I haven't tested this, but it should work!

Good luck,

View solution in original post

4 Replies
Not applicable

Hello Carlo

This won't work because you're trying to use GetText method to set text, try something like the following to replace your last line:


Set MyText = ActiveDocument.GetSheetObject("TX08")
prop = MyText.GetProperties
prop.Layout.Text.v = MyObjectFile.DateLastMadified
MyText.SetProperties prop


Note: I haven't tested this, but it should work!

Good luck,

kaicpa2
Contributor III
Contributor III
Author

It works fine!!!

Thanks a lot for the precious help!!! I could not get it by myself.....

Carlo

rwunderlich
MVP
MVP

How about setting a variable in the script using QV functions instead?

LET vFiletime = FileTime('C:\Documents and Settings\KAICPA2\Desktop\My.qvd');

or

LET vFiletime = QvdCreateTime('C:\Documents and Settings\KAICPA2\Desktop\My.qvd');

And then in your TextBox:

=$(vFiletime)

-Rob

kaicpa2
Contributor III
Contributor III
Author

Thanks a lot

This is the second piece of information I was looking for!

Now with both solution I am able to choose from case to case.

Thanks one more to all of you

Carlo