Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The death of me! Excel and Extra - next row till finished issue 1

Status
Not open for further replies.

southpaw81

Programmer
Feb 19, 2004
16
0
0
US
This is my second post today, I am on a roll. This program I am coding is just massive, and I dont know if I just lost my nerve or skill or both.

I need to tell Extra - that if you see an X in row 3 col 1 on my spreadsheet, then do this. Then search for an X in row 4 col 1 and repeat until their is no more X

----------
Here is what I have so far:

If objWorkbook.Worksheets("Sheet1").Cells(3,1) = "X" then
Sess0.Screen.Row 12
Sess0.Screen.Col 02
Sess0.Screen.Sendkeys("A")
result = objWorkBook.WorkSheets("Sheet1").Cells(3,11).Value
Sess0.Screen.PutString result, 12, 07
Sess0.Screen.Sendkeys("<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Row 11
Sess0.Screen.Col 18
Sess0.Screen.Sendkeys("SPLK")
Sess0.Screen.Sendkeys("<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

If Sess0.Screen.Area( 01, 02, 01, 07, , xBlock) = "Product" then
Sess0.Screen.Row 11
Sess0.Screen.Col 18
Sess0.Screen.Sendkeys("<EraseEOF>MATRL")
End If

Sess0.Screen.Sendkeys("<Enter>")

If Sess0.Screen.Area( 01, 02, 01, 07, , xBlock) = "Product" then
Sess0.Screen.Row 11
Sess0.Screen.Col 18
Sess0.Screen.Sendkeys("<EraseEOF>SRVC")
End If

Sess0.Screen.Sendkeys("<Enter>")

If Sess0.Screen.Area( 01, 02, 01, 07, , xBlock) = "Product" then
Sess0.Screen.Row 11
Sess0.Screen.Col 18
Sess0.Screen.Sendkeys("<EraseEOF>CLEI")
End If

Sess0.Screen.Sendkeys("<Enter>")
End If

Sess0.Screen.Sendkeys("<PF7>")
 
If you're programming in Excel...

For X = 2 to Cells.SpecialCells(xlCellTypeLastCell).Row
You're If statement goes here
Next X

calculus
 
I am actually programming in the macros inside EXTRA. Could I bother you to possibly show me how that would work in the code? I have never see some of those statements.

For X = 2 to Cells.SpecialCells(xlCellTypeLastCell).Row

Maybe if its easier breaking down what each part of that line statement means

And Calculus 'Your a life saver'
 
Since it looks like you're pulling data from Excel, it would be easier to do this in VBA in Excel. You can copy your code into a new module in VBA and it will likely run the same as it did in EB.

Here's a FAQ for Excel: faq99-4069

The code I mentioned above is for use in Excel. It will start at row 2 and execute your "If" statements and other magic for the data in row 2 of Excel, and continue to the bottom of the data.

Maybe I made a jump assumming you're in Excel...


If you are just looking at the screen...
For X = 3 to 25 (Whatever your last row of data is)
If statement Here
Use "X" instead of the actual Row Number from the Screen
Next X

This FAQ may help you in this case: faq99-4087
It appears you need to see the "PutString" function. It will save you some lines of code.

calculus
 
I have 2 questions re running the macro from Excel...

First, do you put a button to start the macro in your Extra session?

Also, does Excel open each time you run a macro stored in Excel? How does that affect your system resources?

Thanks!
 
Not sure of your questions.

If you are in Extra... Start the code however you want. You can set up a button on the users toolbox, or they can access it as a macro through the menus.

As it looks like you're reading and making decisions based on Excel data...
The Excel macro is stored in a "module" inside the excel workbook. You will have to add a module to the project and drop your code into that module. In order to run the code the workbook will need to be open (there might be a way around this, but I've not tried it).

I have Excel open almost all day everyday. If your computer is that tight on resources you probably shouldn't be running code on that machine anyway.

calculus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top