Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default Activating a tab within a window

Using tab keys I'm unable to 'activate' tabs within my window in a workkforce
management program. I need to do this in order to be able to run data
through to this tab from Excel.

I've written the code the populate each tabbed window separately but would
like to combine the code by activating the next tab and using 'sendkeys' to
send a {RIGHT} to select this next tab.

I've tried many combinations of ctrl/alt/shift/F keys etc without success.
I've also tried tabbing through the fields in the first window but this only
leads me out into the left pane explorer window.

Is there any VB code I could use to activate the second tab in the window?
Or Perhaps a combination of 2 or more keys whicih I could 'send' to the
window?

Many thanks for your help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Activating a tab within a window


You don't need to select a sheet to write data to it.
SendKeys is not a reliable method.

You can use a loop to work with each worksheet

Code:
--------------------

Dim ws as WorkSheet

For Each ws in ThisWorkBook.WorkSheets
'code for worksheet
Next ws
--------------------


--
royUK

Hope that helps.

RoyUK
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=25455

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Activating a tab within a window

Ctl + PageDown moves the sheet selection to the right, SendKeys: ^{PGDN}.
Tab key move the cursor or cell outline for the active cell. To select
sheets to the left, use Ctl + PageUp: ^{PGUP}

"Zakynthos" wrote:

Using tab keys I'm unable to 'activate' tabs within my window in a workkforce
management program. I need to do this in order to be able to run data
through to this tab from Excel.

I've written the code the populate each tabbed window separately but would
like to combine the code by activating the next tab and using 'sendkeys' to
send a {RIGHT} to select this next tab.

I've tried many combinations of ctrl/alt/shift/F keys etc without success.
I've also tried tabbing through the fields in the first window but this only
leads me out into the left pane explorer window.

Is there any VB code I could use to activate the second tab in the window?
Or Perhaps a combination of 2 or more keys whicih I could 'send' to the
window?

Many thanks for your help.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default Activating a tab within a window

Roy, many thanks you've convinced me it's possible to get my data onto the
next tab and I agree that sendkeys is not the best way to do it - but as my
knowledge of VB is limited it's usually reliable enough for a quick fix to a
problem.

If I have an Excel SS called: Genesys data input.xls and my first set of
data is on a tab called 'contract' in cells a1:k1 and my 2nd set of data is
on a tab called contractavail in cells b3:p3, how would I convert the
sendkeys code I've written below into a VB script that would achieve the same
results in a more reliable way. This would be an invaluable example which I
could build on for future work.

The first tab I'm sending the 'contracts' data to is called ""WFM
Configuration Utility - Contracts" and the code is as follows:

AppActivate "WFM Configuration Utility - Contracts"

With ThisWorkbook.Sheets("contract")
Application.ScreenUpdating = False

SendKeys "{TAB}"

SendKeys .Range("B1").Value

SendKeys "{TAB}"
SendKeys "{TAB}"

SendKeys .Range("c1").Value

SendKeys "{TAB}"
SendKeys .Range("d1").Value

SendKeys "{TAB}"

SendKeys .Range("e1").Value

SendKeys "{TAB}"

SendKeys .Range("f1").Value

SendKeys "{TAB}"

SendKeys .Range("g1").Value

SendKeys "{TAB}"

SendKeys .Range("h1").Value

SendKeys "{TAB}"

SendKeys .Range("i1").Value

SendKeys "{TAB}"
SendKeys "{TAB}"

SendKeys .Range("j1").Value

SendKeys "{TAB}"

SendKeys .Range("k1").Value



Sheets("contract").Select
Range("A1:z1").Select
Selection.Delete Shift:=xlUp 'Application.Run "'Genesys data
input.xls'!gostart"


Sheets("Start").Select

End With


End Sub


The 2nd tab

I've used the following code to activate the 2nd tab that I want to get data
from the contractavail tab in Excel to is activated as a separate routine,
therfore I activate the window again as "WFM Configuration Utility -
Contracts" and use this:


AppActivate "WFM Configuration Utility - Contracts"


With ThisWorkbook.Sheets("contractavail")

Application.ScreenUpdating = False

SendKeys "{TAB}"
SendKeys .Range("c3").Value


SendKeys "{TAB}"
SendKeys .Range("d3").Value

SendKeys "{TAB}"
SendKeys "{TAB}"

SendKeys .Range("e3").Value
SendKeys "{TAB}"
SendKeys .Range("f3").Value

SendKeys "{TAB}"
SendKeys "{TAB}"

SendKeys .Range("g3").Value
SendKeys "{TAB}"
SendKeys .Range("h3").Value

SendKeys "{TAB}"
SendKeys "{TAB}"


SendKeys .Range("i3").Value
SendKeys "{TAB}"
SendKeys .Range("j3").Value

SendKeys "{TAB}"
SendKeys "{TAB}"

SendKeys .Range("k3").Value
SendKeys "{TAB}"
SendKeys .Range("l3").Value

SendKeys "{TAB}"
SendKeys "{TAB}"

SendKeys .Range("m3").Value
SendKeys "{TAB}"
SendKeys .Range("n3").Value

SendKeys "{TAB}"
SendKeys "{TAB}"

SendKeys .Range("o3").Value
SendKeys "{TAB}"
SendKeys .Range("p3").Value



Sheets("contractavail").Select
Range("b3:p3").Select
Selection.Delete Shift:=xlUp '


Sheets("Start").Select


End With

End Sub


I do appreciate this is a very clumsy, long winded and inaccurate way to get
the result I want but it does work so for now I'm reasonably happy but would
like to improve the way I do things!

Any help would be greatly appreciated!



"royUK" wrote:


You don't need to select a sheet to write data to it.
SendKeys is not a reliable method.

You can use a loop to work with each worksheet

Code:
--------------------

Dim ws as WorkSheet

For Each ws in ThisWorkBook.WorkSheets
'code for worksheet
Next ws
--------------------


--
royUK

Hope that helps.

RoyUK
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=25455


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default Activating a tab within a window

Thanks, that's great!

"JLGWhiz" wrote:

Ctl + PageDown moves the sheet selection to the right, SendKeys: ^{PGDN}.
Tab key move the cursor or cell outline for the active cell. To select
sheets to the left, use Ctl + PageUp: ^{PGUP}

"Zakynthos" wrote:

Using tab keys I'm unable to 'activate' tabs within my window in a workkforce
management program. I need to do this in order to be able to run data
through to this tab from Excel.

I've written the code the populate each tabbed window separately but would
like to combine the code by activating the next tab and using 'sendkeys' to
send a {RIGHT} to select this next tab.

I've tried many combinations of ctrl/alt/shift/F keys etc without success.
I've also tried tabbing through the fields in the first window but this only
leads me out into the left pane explorer window.

Is there any VB code I could use to activate the second tab in the window?
Or Perhaps a combination of 2 or more keys whicih I could 'send' to the
window?

Many thanks for your help.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Activating EXCEL window from PowerPoint Barb Reinhardt Excel Programming 0 August 17th 07 02:06 AM
changing sheet in window without activating it rumi Excel Programming 0 September 13th 05 02:16 AM
Grabbing data from diff window w/o activating it McManCSU[_28_] Excel Programming 1 August 18th 05 08:44 PM
Error on activating a window a open workbook Hari[_3_] Excel Programming 1 June 11th 04 12:58 AM
De-Activating the menu option, Window - Unfreeze Mario[_6_] Excel Programming 0 January 12th 04 06:57 PM


All times are GMT +1. The time now is 06:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"