Run-time error '9': - Subscript out of range

Creating a macro - Writing a Script - Using the API

Run-time error '9': - Subscript out of range

Postby KapilSoni » Wed Dec 17, 2014 8:32 am

Hi,

I'm a novice programmer (kind of make shift), please ignore accordingly.

I wrote codes using this logic, it works in one, but fails in other macro file. Error I get is:

Run-time error '9':
Subscript out of range


Code:
Code: Select all   Expand viewCollapse view
Dim wbPending, wbAccept, wbReject As Workbook


.. some lines ..
Code: Select all   Expand viewCollapse view
Set wbPending = ActiveWorkbook
wbPending.Worksheets("PendingTransaction").Range("C2").Value = "TESTING ..."


The above error message appears on line:- wbPending.Worksheets("PendingTransaction").Range("C2").Value = "TESTING ..."


Can anyone help on the same ?

I guess, I've done something very silly :?
:crazy:
OpenOffice 4.0.1 on Windows XP
KapilSoni
 
Posts: 8
Joined: Tue Dec 09, 2014 11:19 am

Re: Run-time error '9': - Subscript out of range

Postby KapilSoni » Wed Dec 17, 2014 9:27 am

P.S.: I was able to overcome this issue by adding line
Code: Select all   Expand viewCollapse view
wbPending.Activate
. However, I wonder the reason behind this !!!
OpenOffice 4.0.1 on Windows XP
KapilSoni
 
Posts: 8
Joined: Tue Dec 09, 2014 11:19 am


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 8 guests