excel-vba if function message "collection is one-based" -


I got an error message "The collection is one-based" but I did not know what is wrong with my code.

The following table is Detector: dp2 = ActiveDocument.DataProviders ("Test2")

  Quantity Switching Currency ------- - ----------------------------- 1) 150 yi EUR 2) 250,006 n 3d 3) 132,4 y ur 4) 24 y GBP5) 1 NAD   

Now I must send an automated email based on these data. I need a function in Excel-VBA that appears in every line for the value of the column "switchman".

When the value is "N", then I have to enter the character "P" in the email. When the value is "Y", then I must give the value of the column "currency".

The result of my email should look like this:

  1) 150 EUR 2) 250,006 p3) 132,4 EUR 4) 24 gbp 5) 1p   

I tried to achieve this with the following task:

  Datapriver dip as a string thumb DP 1 in the form of slow stroke DP 2 = Active Documents. Data Providers ("Test 2") DIM K as the integer string in the form of dim number if DP2 Columns ("Switchman"). Item (k) = "n" then numcurr = "p" or either numcurr = dp2.Columns ("currency"). Items (a) for end if = 1 to DP 2. Columns (1). Points Strawberry = DP2 Columns ("Quantity"). (K) & amp; "Numcurr" debug.print strbody Next k   

This function gives me an error message "The collection is one-based" What's wrong with my code?

Note:

I know that if only I can add a column in Excel with the formula () but unfortunately this is not the case. In case a solution

You use the variable for your loop k but because you just decalared it as an integer and did not set it, it missed 0. is based on Columns.Item () 1 (item starts with 1, no 0) then you get an error set k before you use it.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -