Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Excel Sheet Tabs
#1
I am trying to get from one tab to another in Excel. How do I do that?

TIA.

Carl
#2
I don't know a hotkey for it. You can record Excel macro.

In QM, it would be:

Code:
Copy      Help
typelib Excel {00020813-0000-0000-C000-000000000046} 1.2
Excel.Application a._getactive
Excel.Worksheet ws=a.Worksheets.Item("Sheet2")
ws.Select
#3
Thanks!! That works great.
#4
This worked on Friday and now does not. I copied the code again from your previous post and it still does not work.

What happened?

Deb
act "Microsoft Excel"
typelib Excel {00020813-0000-0000-C000-000000000046} 1.2
Excel.Application a._getactive
Excel.Worksheet ws=a.Worksheets.Item("Sheet2")
ws.Select
#5
What error is displayed, and in which line?

MS Office apps have this strange behavior: when application is just launched, _getactive does not work, because it does not register its objects at startup (to minimize overhead, I think). _getactive begins to work only when you first time deactivate the app (that is, make active some other window).
#6
The exact error is :
Error (RT) in Macro3: 0x800A03EC,

It is happening on line :
Excel.Worksheet ws1=a.Worksheets.Item("Sheet2")

Thanks again.
#7
This error is shown when I closed the document. Maybe at that time Excel is just started and there is no document open. Try to insert a delay before.
#8
Did you maybe change the name of the 2nd sheet to something other than "Sheet2"? The macro code assumes it is "Sheet2"
#9
Why this code doesn't work?

Code:
Copy      Help
ExcelSheet es.Init("" 8|16)
Excel.Worksheet wo=es.ws.Application.Worksheets.Item(1)
wo.Name="name1"
es.SetCell("test1" 1 1)
wo=es.ws.Application.Worksheets.Item(2)
wo.Name="name2"
wo.Activate
es.SetCell("test2" 1 1)
#10
Works, but shouldn't the last statement set cell in the second worksheet?

Macro
Code:
Copy      Help
;/exe 1
ExcelSheet es.Init("" 8|16)
es.ws.Name="name1"
es.SetCell("test1" 1 1)
es.ws=es.ws.Application.Worksheets.Item(2)
es.ws.Name="name2"
es.ws.Activate
es.SetCell("test2" 1 1)
#11
Yes.

Thank you.

Now, it works.


Forum Jump:


Users browsing this thread: 1 Guest(s)