PDA

View Full Version : displaying contents of a textbox which is refenced using a set of strings



TekTeam
06-23-2011, 02:57 AM
Hi,

We are new here, so sorry if this is done in the wrong place but would appreciate some help if possible.

We are creating a sales pitch in powerpoint 2007 which has the ability to quote for services based on predefined figures held in hidden texboxes.

The data is setup for example in a 3 by 3 grid although each field is a seperate texbox.

If you can understand what we have done here there are essentially three rows and three columns.

We have successfully created a set of strings which pull 3 variables out and create the object name for one of the texboxes depending on what questions were selected previously in the sales pitch.

the first variable is the slide var1(slidenumber). there are a couple of these 3 x 3 grids for example on different slides. the second variable creates the column in that grid var2(columnA,B or C) and finally the third is the row number var3(row1,2 or 3)

The final string would look something like this:

slide1.A1

where A1 on slide 1 is a texbox within a 3 x 3 grid.

Now problem we have is that we need this string to be displayed in another textbox, essentially the quote price box and for it to be the value within the text box A1 on slide 1.

But the code errors on the last string which is the bit that pulls all three together to make the reference but when you run the slideshow it errors saying that strTableCell is an invalid identifier (I have put asterix around this bit in the code example below)

Any help with this appreciated.

Private Sub btnQuote_Click()
Dim strSlideName As String
Dim strSlideColumn As String
Dim strSlideRow As String
Dim strTableCell As String

strSlideName = Slide5.EntitySlideValue.Value
strSlideColumn = Slide5.TurnoverColumnValue.Value
strSlideRow = Slide5.RecordsRowValue.Value
strTableCell = strSlideName & "." & strSlideColumn & strSlideRow

Me.quoteTotal.Value = *strTableCell*.Value




End Sub


thanks in advance,

Chris

John Wilson
06-23-2011, 03:16 AM
You are treating strTableCell etc as if its a String but you are trying to use as an OBJECT in the faulting line. You would need to have a series of CASE statement to select the correct object.value.

It's also very unclear exactly what you are trying to do.

TekTeam
06-23-2011, 03:30 AM
Hi John,

The code works up to the point where slide5.A1 is referenced as strTableCell.value

We have three questions:

What company entity are you (Limited, Sole Trader, Partnership)

Depending on the answer to this 1 of 3 groups of textboxes are needed. (each on a separate slide)

Lets say Limited was selected:

The string strSlideName is slide5

The next question is what is your Turnover? 50-100 101-150 or 151 + (Columns A, B, Or C. see exmaple table below, remembering each figure is wihtin a texbox)

A B C
800 1000 2000
1000 1200 2200
1200 1400 2400

The next question asks how records are kept? option 1 2 or 3 (row 1, 2 or 3)

So in this example the customer has answered, Limited (slide5, strSlideName = slide5)

They also selected 0-50 turnover (column A, strSlideColumn = A)

And then they selected option 1 to the last question (row 1, strSlideRow = 1

then

strTableCell = strSlideName & "." & strSlideColumn & strSlideRow

which creates slide5.A1

this works up to here and on btn_click displays slide5.A1 in a results text box.

what we want is for strTableCell (slide5.A1) to display '800' in the results textbox.

Hope this helps and thanks for your quick reply.

Chris

John Wilson
06-23-2011, 03:44 AM
No you don't understand
What you are creating is a string "Slide5.A1"

Slide5 is an OBJECT and cannot be referenced as a string.

Personally I'd store the possibilties in a multi dimension array and put the answer in a normal PowerPoint shape.

TekTeam
06-23-2011, 03:50 AM
Hi John,

I was just trying to explain what we had done.

We dont know how to do it any other way as never tried doing this before.

Can you provide any further assistance with this?

There may be someone we know that can explain further your recommendation but they are not available for a few weeks and we need to get this working today :( been working on it for over a week now lol. Lost lots of hair and the remaining has now gone grey.

I appreciate your replies.

Chris

John Wilson
06-23-2011, 04:08 AM
No offence meant but this is obviously a commercial project and I can see you're not a PowerPoint coder so I' m really not going to code it for free! You want to hire one of our coders then we can rush it probably today but it would cost you!

You want to get in touch it's john ATSIGN pptalchemy.co.uk

TekTeam
06-23-2011, 04:16 AM
No offence taken John,

This is an internal project to aid our sales department. I would not have expected you to do it for nothing.

I will send you an email and perhaps receive a quotation from you and then I can escalate this to the relevant head.

Many thanks

Chris