Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sheet ID or Name

Hi All,

I want to write a macro to set the sheet name.

Somthing like this:

If SheetName = A then

vsht = A

If SheetName = B then

vsht = B

If SheetName = C then

vsht = C

but i am unable to to refer sheet name in Macro.

please tell me correct code to access sheet id or name in macro.

Thanks in advance.

1 Solution

Accepted Solutions
Not applicable
Author


Marcel Olmo wrote:
Hey Darius, thanks for your contribution.
May I ask you what if I want to know the list of all the id's of all the sheets? Is that possible?
I just want to loop over all the sheets in one macro, and first of all, I have to get how can I do that. Am I right?
Thanks in advance!!<div></div>


you can use this code as your basis:

sub LoopSheet

for i = 0 to ActiveDocument.NoOfSheets - 1

set ss= ActiveDocument.GetSheet(i)

msgbox(ss.GetProperties.SheetId)

next

end sub



View solution in original post

5 Replies
d_pranskus
Partner - Creator III
Partner - Creator III

Hi

You could get name or ID of active sheet using following expression

ActiveDocument.ActiveSheet.GetProperties.Name

ActiveDocument.ActiveSheet.GetProperties.SheetId

Look at ApiGuide.qvw for more infoemation. It should be in c:\Program Files\QlikView\Documentation folder if you installed full set of QlikView features.

Cheers

Darius



marcel_olmo
Partner Ambassador
Partner Ambassador

Hey Darius, thanks for your contribution.

May I ask you what if I want to know the list of all the id's of all the sheets? Is that possible?

I just want to loop over all the sheets in one macro, and first of all, I have to get how can I do that. Am I right?

Thanks in advance!!

Not applicable
Author


Marcel Olmo wrote:
Hey Darius, thanks for your contribution.
May I ask you what if I want to know the list of all the id's of all the sheets? Is that possible?
I just want to loop over all the sheets in one macro, and first of all, I have to get how can I do that. Am I right?
Thanks in advance!!<div></div>


you can use this code as your basis:

sub LoopSheet

for i = 0 to ActiveDocument.NoOfSheets - 1

set ss= ActiveDocument.GetSheet(i)

msgbox(ss.GetProperties.SheetId)

next

end sub



marcel_olmo
Partner Ambassador
Partner Ambassador

Thank you very much mOngkz

that was what I was looking for.

See you around!!

softsystemit
Partner - Contributor III
Partner - Contributor III

Hello

If anyone knows, please tell me.
How to find out the REAL number of sheets of Document;
I opened a topic for it.
http://community.qlik.com/forums/p/41098/162300.aspx # 162300

Thank!

Olá

Se alguem souber, me diga por favor.
Como descobrir o real numero de sheets do documento;
Abri um tópico pra isso.
http://community.qlik.com/forums/p/41098/162300.aspx#162300

Obrigado!