I am new to RPA/Blue Prism.
I have a problem with the Action "Get Worksheet as Collection".
In the excel sheet are hidden columns and these are not found.
Blue Prism returns error message:
Internal: Could not execute code stage because exception thrown by code stage: Column 17 was not found.
I've already tried the other Get Worksheet * actions
How can I get Blue Prism to read the hidden columns or make it unhidden so that it can be read?
The problem was not the hidden lines. However, I have found the error it was the line breaks (char 10 +13). Thank you anyway!
Can you provide more information?
i think you can unhide all column through this macro or use the robot to unhide them
`Sub UnhideAllColumns ()
Cells.EntireColumn.Hidden = False EndSub`
let me know if it helps out
Related
How do I extract only the available active cell values into a collection? I've got an excel file that has 10 cell values but the blue prism process is reading is entire rows from the excel. Thanks in advance.
Well, to do that you'll need two actions:
1) The action that will return the active range
2) Action: "Get Worksheet Range as Collection"
The first action is not supplied out of the box, in standard "MS Excel VBO", but the code is really simple to write. It's should be just a code stage with one line of code
input: handle as number, Workbook_Name as string
output: range as string
x = GetWorkbook(handle, Workbook_Name).ActiveSheet.Selection.Address
(Disclaimer: I haven't tested that code)
The second one action is I think standard one, so you should be able to find it in your object.
I'm creating an Excel file from data in an Access database.
All I'm currently trying to do is offset a selection I've made in Excel from Access, and I keep receiving errors.
ExcelWS.Range(Range("H6"), Range("H6").End(xlDown)).Offset(0, -1).Select
ExcelWS is an Excel. Worksheet object.
My goal is to select from G6 to the end of the workbook. However, not every cell in column G is populated, so a simple End(xlDown) from cell G6 only takes me part way through the file. That being said, all cells in column H are populated, so I'm able to do an End(xlDown) from cell H6. From there, I want to move my selection one to the left, giving me the desired range in column G selected.
The above code is a product of about 2hrs of googling, and trying tons of different combinations of similar code. However, I'm still receiving an error.
Run-time error '1004':
Method 'Range' of object '_Global' failed
The odd thing is that 1/10 times, I'll receive the desire results. The rest of the time I receive the above error.
I feel as though my issue has something to do with running that line of code from Access, however that's currently my only way of completing this task as I have other things that rely on being able to do it from Access.
Any help would be appreciated, and if there's any more info I can give I'll try my best.
Thanks.
To run Select the sheet shoudl be active/ in -focus.
So you ned to set foucus to sheet.
ExcelWS.Activate
ExcelWS.Range(Range("H6"), Range("H6").End(xlDown)).Offset(0, -1).Select
Simalarly, to make the seet in-focus, your workbook needs to be active/ infocus.
Try to avoid Select as much as possible. Also fully qualify the names.
Dim rngTest as Range
Set rngTest= ExcelWS.Range(ExcelWS.Range("H6"), ExcelWS.Range("H6").End(xlDown)).Offset(0, -1)
Thanks to #cyboashu, I was able to get it working.
I took the examples he gave me and mushed them together to make it do what I wanted.
I realized after posting the question that it was working every other time, consistently.
Anyway, the code I used is
Dim ExcelR1 As Range
Set ExcelR1 = ExcelWS.Range(ExcelWS.Range("H6"), ExcelWS.Range("H6").End(xlDown)).Offset(0, -1)
ExcelR1.Activate
I have attempted the solution previously posted
https://stackoverflow.com/a/31642837/6463950
but whilst this code works nicely it doesn't get round the issue of wanting to have the database hidden from the user view. Has anyone determined a way to do this?
I am using the following code. If I hide the worksheet or hide the columns on TimeCapture then I get a runtime error '1004'
Sub OrderEntry()
Sheets("TimeCapture").Select
Range("a1").CurrentRegion.Name = "database"
ActiveSheet.ShowDataForm
End Sub
There is no need to select or active the sheet. You can even have the worksheet hidden.
Use:
Sheets("TimeCapture").ShowDataForm
I’m running excel 2010 on windows 7.
The following macro does what you would expect, ie (1) inserts a new worksheet, (2) adds a rectangle, and (3) activates cell A1.
Sub addSheetAndButton()
Dim buttonSheet As Worksheet
Set buttonSheet = ThisWorkbook.Sheets.Add
buttonSheet.Shapes.AddShape(msoShapeRectangle, 100, 100, 100, 50).Select
buttonSheet.Range("A1").Activate
End Sub
My problem is when I try to run it with a Worksheet.Activate event, for example:
Private Sub Worksheet_Activate()
Call addSheetAndButton
End Sub
This time (1) a new worksheet is not inserted, (2) the rectangle is added to the worksheet associated with the activate event, (3) cell A1 is not activated and (4) the rectangle remains activated.
What am I doing wrong? Any help would be greatly appreciated.
Thanks very much for trying this. I’m sorry it has taken me a while to get back, but I’ve been experimenting with this. I have discovered that when I exit and restart Excel, the addSheetAndButton macro works as expected under the Worksheet.Activate event. However, I have a different macro that uses another Worksheet.Activate event to update some charts. On what seemed to be a random basis, this would create a “run time error 6” - an overflow that resulted from trying to assign an out of bounds value to a variable.
I never got this error if I bypassed the Worksheet.Activate event/macro and ran the chart update macro by hand. After resetting VBA/Excel from the “run time error 6”, the addSheetAndButton macro behaved exactly as I described in my original post. The only way to cure it was to exit and restart Excel.
I think (hope) that I have traced the source of the run time error back to a line in my chart update macro where I had selected rather than activated a worksheet before reading data from it – though I am surprised at the result. It is worth pointing out that once Excel entered the “not as expected” state, the on-screen message from the following two lines was the name of the previous active sheet and not “Sheet1”.
Worksheets(“Sheet1”).Activate
Msgbox ActiveSheet.Name
Again, the only apparent way to cure this was to exit and restart Excel.
Thanks again for your help.
I need to move a row of data to another worksheet when a user chooses a value in a listbox. I am trying to use the following code to select the row on the new worksheet I want to move the data to:
'Move data to the "Red" worksheet
Sheets("Red").Range ("A11").Select
I am getting an "Object does not support this property or method" error.
What am I doing wrong?
There should NOT be a space between "Range" and "(".
Is selecting allowed on your sheet? (= selection not prohibited by protection)
I have noticed a space character between the word Range and ("A11"). This might have caused a syntax error.
Use the macro recorder and manually perform the operation you want. Then you can look at the code recorded by Excel and clean it up to suit your needs.
The macro recorder is the easiest way to figure out whatever convoluted syntax VBA wants you to use.