Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default put cell valve in a text box

I posted this today but I don't know if I was clear in what I was
asking.....
I need to put a cell value of an unopened excel sheet in a text box.
When I open outlook a user form automatically comes up with a bunch of
text boxes that I need filled with certain cells (they are formulas).

The cells are in the following excel sheet

\\Mascarolinabdc\puball\Newport Precision\Spreadsheets\NPI PVD Log
Sheet.xls
The sheets are "maintenance 1", "maintenance 2", and "maintenance 3"







  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default put cell valve in a text box

Sub getdata()


FName = "\\Mascarolinabdc\puball\Newport Precision\" & _
"Spreadsheets\NPI PVD Log Sheet.xls"
Set databk = Workbooks.Open(Filename:=FName)

With databk

Item1 = .Sheets("maintenance 1").Range("A1").Value
Item2 = .Sheets("maintenance 2").Range("A1").Value
Item3 = .Sheets("maintenance 3").Range("A1").Value

End With
databk.Close

End Sub


" wrote:

I posted this today but I don't know if I was clear in what I was
asking.....
I need to put a cell value of an unopened excel sheet in a text box.
When I open outlook a user form automatically comes up with a bunch of
text boxes that I need filled with certain cells (they are formulas).

The cells are in the following excel sheet

\\Mascarolinabdc\puball\Newport Precision\Spreadsheets\NPI PVD Log
Sheet.xls
The sheets are "maintenance 1", "maintenance 2", and "maintenance 3"








  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default put cell valve in a text box

where does this go?

I have put it in my form but nothing...
how do I get item1 into textbox 1?
I used textbox.value = item 1 but that doesnt work

I also changed item1 to textbox1 and it didn't work

Please help

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default put cell valve in a text box

It help to know if there was an error or the data just didn't get into the
textbox. It is hard to tell what you mean when you say that it didn't work.
You have a space between the word Item and the number 1. Not sure if that is
in you code.

The best way to debug the problem is to add msgbox(s) to see if the problem
is reading the workbooks or writing to the text box. Try this modified code.
Check to see if a new excel workbook opens when the code runs. Let me know
exactly what any error message are displayed and the line which is
highlighted in yellow because this greatly helps solve the problems.

Sub getdata()


FName = "\\Mascarolinabdc\puball\Newport Precision\" & _
"Spreadsheets\NPI PVD Log Sheet.xls"
Set databk = Workbooks.Open(Filename:=FName)

With databk

Item1 = .Sheets("maintenance 1").Range("A1").Value
textbox1.value = item1
msgbox("Item 1 = " & Item1)
Item2 = .Sheets("maintenance 2").Range("A1").Value
textbox1.value = item2
msgbox("Item 2 = " & Item2)
Item3 = .Sheets("maintenance 3").Range("A1").Value
textbox1.value = item3
msgbox("Item 3 = " & Item3)

End With
databk.Close

End Sub

" wrote:

where does this go?

I have put it in my form but nothing...
how do I get item1 into textbox 1?
I used textbox.value = item 1 but that doesnt work

I also changed item1 to textbox1 and it didn't work

Please help

Thanks


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default put cell valve in a text box

Joel,

It works !!!

with one problem.....
WHen I put the code into excel no problem but when I put the dialog
box in outlook it won't open

I get object not found when it trys to open the spread sheet to get
the info.

Is there something special about outlook?

The email exchage server is not on our local server but instead at our
corporate office...is that the reason?


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default put cell valve in a text box

There are two flavors or Macro code. the one that works with Excel and the
one that works with other Office products. Outlook doesn't understand a
workbook but can open an excel object. Lokk at this code

Sub test()

Folder = "C:\Documents and Settings\Guest\My Documents\"
FName = "book1.xls"

Set exelbook = GetObject(Folder & FName)

With exelbook
.Application.Visible = True
.Parent.Windows(FName).Visible = True

Item1 = .Sheets("maintenance 1").Range("A1").Value
textbox1.Value = Item1
MsgBox ("Item 1 = " & Item1)
Item2 = .Sheets("maintenance 2").Range("A1").Value
textbox1.Value = Item2
MsgBox ("Item 2 = " & Item2)
Item3 = .Sheets("maintenance 3").Range("A1").Value
textbox1.Value = Item3
MsgBox ("Item 3 = " & Item3)

.Save
.Close
End With

End Sub


" wrote:

Joel,

It works !!!

with one problem.....
WHen I put the code into excel no problem but when I put the dialog
box in outlook it won't open

I get object not found when it trys to open the spread sheet to get
the info.

Is there something special about outlook?

The email exchage server is not on our local server but instead at our
corporate office...is that the reason?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert cell value from a formula to a valve on save [email protected] Excel Discussion (Misc queries) 2 March 2nd 08 01:39 AM
select text in cell based on text from another cell, paste the text at the begining of a thrid cell, etc... jsd219 Excel Programming 0 October 19th 06 05:04 PM
Is it possible to choose a macro based upon a valve of a variable?? Rob947[_2_] Excel Programming 2 May 31st 05 05:30 PM
Run MACRO from the valve of a cell? FX Boudreaux Excel Programming 2 August 12th 04 08:07 AM
How to pass valve in combobox object to cell chanon Excel Programming 3 October 15th 03 04:25 AM


All times are GMT +1. The time now is 07:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"