TIP: Click on subject to list as thread! ANSI
echo: visual_basic
to: All
from: Bob
date: 2003-07-29 15:17:00
subject: How can I get this to wor

Dim ExApp As Object
Hello

I have an excel spreadsheet that will alway be named differently. I
need to import the data into text boxes so I can save it to a
database. All the textboxes will not fit on a single form so I had to
brak it up into 3 forms. I may be able to get it to 2. What I am
trying to get is when I select the file I would like it to populate
the 3 forms and text boxes at the same time. Thn I can next my way
thru each form to verify the data before saving it. I do not know how
to create a module. 

If anyone can help me I would be greatful. I am still new to VB

Dim WkBk As Object
Dim WkSht As Object
Dim tmpSheet As Object
'Set myexcel = CreateObject("Excel.Application")

Set ExApp = CreateObject("Excel.Application")   'Creates new instance
of Excel
    strFile = ExApp.GetOpenFilename     'Opens dialog box so user can
pick file to open
Set WkBk = ExApp.Workbooks
    WkBk.Open strFile       'Opens chosen file
Set WkSht = ExApp.ActiveSheet     'Selects the active (topmost)
worksheet
    
    'On Form1
    txtAdd.Text = WkSht.Cells(7, 3) 
    txtAdd2.Text = WkSht.Cells(8, 3)
    txtAdd3.Text = WkSht.Cells(9, 3)
    txtCity.Text = WkSht.Cells(10, 3)
    txtContact.Text = WkSht.Cells(11, 3)
    txtCustomer.Text = WkSht.Cells(6, 3)
    txtDate.Text = WkSht.Cells(2, 5)
    txtPhone.Text = WkSht.Cells(11, 8)
    txtShipper.Text = WkSht.Cells(5, 3)
    txtState.Text = WkSht.Cells(10, 6)
    txtTech.Text = WkSht.Cells(2, 8)
    txtZip.Text = WkSht.Cells(10, 8)
    
    'On Form2
    txtCams.Text = WkSht.Cells(17, 3)
    txtCPU.Text = WkSht.Cells(19, 3)
    txtIP.Text = WkSht.Cells(18, 3)
    txtLic.Text = WkSht.Cells(18, 8)
    txtMail.Text = WkSht.Cells(17, 8)
    txtModem.Text = WkSht.Cells(16, 8)
    txtOS.Text = WkSht.Cells(16, 3)
    txtSoftWare.Text = WkSht.Cells(15, 3)
    txtVer.Text = WkSht.Cells(15, 7)
    
    'On Form3
    txtAddPtr.Text = WkSht.Cells(29, 4)
    txtAddPtr1.Text = WkSht.Cells(29, 6)
    txtAddPtr2.Text = WkSht.Cells(29, 8)
    txtKey.Text = WkSht.Cells(26, 4)
    txtKey1.Text = WkSht.Cells(26, 6)
    txtKey2.Text = WkSht.Cells(26, 8)
    txtMon.Text = WkSht.Cells(25, 4)
    txtMon1.Text = WkSht.Cells(25, 6)
    txtMon2.Text = WkSht.Cells(25, 8)
    txtMse.Text = WkSht.Cells(27, 4)
    txtMse1.Text = WkSht.Cells(27, 6)
    txtMse2.Text = WkSht.Cells(27, 8)
    txtOther.Text = WkSht.Cells(31, 4)
    txtOther1.Text = WkSht.Cells(31, 6)
    txtOther2.Text = WkSht.Cells(31, 8)
    txtRpt.Text = WkSht.Cells(28, 4)
    txtRpt1.Text = WkSht.Cells(28, 6)
    txtRpt2.Text = WkSht.Cells(28, 8)
    txtScale.Text = WkSht.Cells(30, 4)
    txtScale1.Text = WkSht.Cells(30, 6)
    txtScale2.Text = WkSht.Cells(30, 8)
    txtSysUnit.Text = WkSht.Cells(24, 4)
    txtSysUnit1.Text = WkSht.Cells(24, 6)
    txtSysUnit2.Text = WkSht.Cells(24, 8)

ExApp.Workbooks.Close
Set ExApp = Nothing
Set WkBk = Nothing
Set WkSht = Nothing


Thanks
Bob
---
þ RIMEGate(tm)/RGXPost V1.14 at BBSWORLD * Info{at}bbsworld.com

---
 * RIMEGate(tm)V10.2áÿ* RelayNet(tm) NNTP Gateway * MoonDog BBS
 * RgateImp.MoonDog.BBS at 7/29/03 3:17:03 PM
* Origin: MoonDog BBS, Brooklyn,NY, 718 692-2498, 1:278/230 (1:278/230)
SEEN-BY: 633/267 270
@PATH: 278/230 10/345 106/1 2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.