Help PLEASE


Posted by Stuart Purvis on November 07, 2001 12:50 PM

We are doing A-Level here at my School.
I am the ICT TECHINICAN an I have a couple of problems that our pupils are facing and was looking for help.

1)One pupil is doing aspreadsheat on a pizza shop, on Sheet1 the user will select a particular Item IE
Large Pizza 4.99. What we want to happen is this information that is in 2 seperate cells is transfered to another sheet that is called Bill. So that a bill can be calculated and printed.

2) we want to be able to open/launch another program IE word automaticly depending on what a cell value is IE if A1=1 then open file "WARNING.DOC" but if A1=2 then do nothing.


Hope you can help I do have another question but will post that one when and if i get answers to the above.
Please someone help as it is driving me and the ICT Teacher carzy.

Can Answer be as simple as possible.

Thanks
Stuart

Posted by Mark O'Brien on November 07, 2001 2:18 PM

OK, simple answers, but first a simple question.

When the pupil selects the item on sheet1 (e.g. "Large Pizza") how do they select that item on the spreadsheet? Do they just select the cell that contains "Large Pizza" or is there a button or something the click?

Part 2 is fairly straightforward.

I used A1="1" as per your example. This code will open a word document called "Test.Doc" in "C:\Temp", so just change it to suit your needs. This code needs to go onto the Sheet Object (i.e. right click on whatever spreadsheet tab you want it to be on and select "View Code")

Private Sub Worksheet_Change(ByVal Target As Range)

Dim wrdApp As Object
Dim wrdDoc As Object

If Me.Range("a1") = 1 Then
Set wrdApp = CreateObject("word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.documents.Open("c:\Temp\test.doc")
End If
End Sub

Just repost an answer to that question.

Cheers

Mark


Posted by Stuart Purvis on November 08, 2001 1:01 AM

RE ANSWER TO MARK O'BRIEN QUESTION

We want to select the Items VIA tick Boxes but if it is not possible that way then select items via Boxes.

We have had a response to the question from someone else and he provided a way of doing in VB
IT does what we want but not via Tick Boxes or buttons and as the pupils here would not know VB from C++ it is diffucult to explain it to them hence simple answers were possible.

OK, simple answers, but first a simple question. When the pupil selects the item on sheet1 (e.g. "Large Pizza") how do they select that item on the spreadsheet? Do they just select the cell that contains "Large Pizza" or is there a button or something the click? Part 2 is fairly straightforward. I used A1="1" as per your example. This code will open a word document called "Test.Doc" in "C:\Temp", so just change it to suit your needs. This code needs to go onto the Sheet Object (i.e. right click on whatever spreadsheet tab you want it to be on and select "View Code") Private Sub Worksheet_Change(ByVal Target As Range) Dim wrdApp As Object If Me.Range("a1") = 1 Then Set wrdApp = CreateObject("word.Application") wrdApp.Visible = True Set wrdDoc = wrdApp.documents.Open("c:\Temp\test.doc") End If

: We are doing A-Level here at my School. : I am the ICT TECHINICAN an I have a couple of problems that our pupils are facing and was looking for help. : 1)One pupil is doing aspreadsheat on a pizza shop, on Sheet1 the user will select a particular Item IE : Large Pizza 4.99. What we want to happen is this information that is in 2 seperate cells is transfered to another sheet that is called Bill. So that a bill can be calculated and printed. : 2) we want to be able to open/launch another program IE word automaticly depending on what a cell value is IE if A1=1 then open file "WARNING.DOC" but if A1=2 then do nothing. : : Hope you can help I do have another question but will post that one when and if i get answers to the above. : Please someone help as it is driving me and the ICT Teacher carzy. : Can Answer be as simple as possible. : Thanks : Stuart


Posted by Mark O'Brien on November 08, 2001 9:37 AM

Re: RE ANSWER TO MARK O'BRIEN QUESTION

Do you need to the process explained more than getting someone to do the actual coding? Obviously the kids wont learn too much if they're spoonfed an answer.

What A-Level is this anyway?

I'm busy right now, but I'll have time this evening to mess around. It's after 5.30pm GMT just now so I don't think you'll be in too great of a hurry to get an answer today. We want to select the Items VIA tick Boxes but if it is not possible that way then select items via Boxes. We have had a response to the question from someone else and he provided a way of doing in VB IT does what we want but not via Tick Boxes or buttons and as the pupils here would not know VB from C++ it is diffucult to explain it to them hence simple answers were possible.




Posted by Rick on November 08, 2001 1:18 PM

I emailed you an Excel program that does problem one. DId you get it? Was that what you were looking for?