John It is perfect and worked the first time.......thanks
Terry M Evans, CPHIMS Chief Information Officer 985 435-4820 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED] Sent: Tuesday, October 21, 2003 1:35 PM To: [EMAIL PROTECTED] Subject: Re: [Talk] Reading/Editing Excel with VB The publics: Public oExcel As Object Public stroBook As String Public oBook As Object Public stroSheet As String Public oSheet As Object Dim intRow As Integer Dim strCell As String The sub to open the sheet: (I have a module called modPublic I put this in.) Sub subExcelLoad() Set oExcel = CreateObject("Excel.Application") 'see cmdOk Set oBook = oExcel.Workbooks.Open(stroBook) 'stroBook is public and defined else where. It certainly could be a variable passed in. Set oSheet = oBook.Worksheets(stroSheet) 'ditto oSheet.Activate oExcel.Visible = True intRow = 1 'This is the first row of data strCell = "A" & intRow oSheet.range(strCell).Select End Sub Then to postition the cell pointer and get its contents: strCell = "A" & intRow oSheet.range(strCell).Select variable = Trim(oExcel.ActiveCell.Value) or to do it all relative: variable = oExcel.ActiveCell.offset(0, 2).Value ' means to columns over from cell pointer. negative values to left. First argument is row +/-. to close is just oBook.close or oExcel.close ( I always do a close all at the end of a program) John John Curtiss Hutchinson Area Health Care 1095 Highway 15 South Hutchinson MN 55350 320-234-4967 [EMAIL PROTECTED] "Terry Evans" <[EMAIL PROTECTED] To: [EMAIL PROTECTED] .com> cc: Sent by: Subject: [Talk] Reading/Editing Excel with VB [EMAIL PROTECTED] TATION.COM 10/21/2003 01:13 PM Please respond to Talk Anyone have sample code for reading/editing/writing excel spreadsheets? Terry M Evans, CPHIMS Chief Information Officer 985 435-4820 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Rich McNeil Sent: Monday, October 20, 2003 8:59 PM To: [EMAIL PROTECTED] Cc: 'Linda Ralston' Subject: RE: [Talk] Boston Software and VBA Forms Linda, I have good news and bad news. The good news is, you can add Microsoft Windows Common Controls to a form in VBA just as you'd add it to a VB project's UserForm object (Insert the UserForm and give it focus. It takes all the usual components this way. The bad news is that VBA uses "Forms2" a more "advanced" version of VB's forms. VBA's Forms2 is quite different from VB's, and I think it's pretty bad. You'll probably have to start your Form design from scratch although a lot of your code can be transported between them. Two major differences?no Timer component and an odd reliance on Modal forms. Sorry, I missed your message. Rich McNeil Boston Software Systems 866 653 5105 www.bostonworkstation.com -----Original Message----- From: Linda Ralston [mailto:[EMAIL PROTECTED] Sent: Monday, October 20, 2003 12:59 PM To: [EMAIL PROTECTED] Subject: Boston Software and Visual Basic Hi there. I sent an e-mail through [EMAIL PROTECTED] and wasn't able to get help on my question. I'll rephrase the question. When I use Boston Workstation the Visual Basic that comes with it is limited. VBA rather than Visual Basic. I am used to using Visual Basic and have written programs that access Microsoft Windows Common Controls. Specically I am trying to allow the user to open the "File Open" dialog box to pick the file they need to work with. I can't figure out how to do this with VBA? Is this a stupid question? Can you help me? By the way, please pass on a Thankyou to your company for the cookies that were sent to our office from Boston Workstation. They were very much appreciated. Thanks. Linda Ralston, ISP Applications Analyst Peace Country Health Grande Prairie, AB Canada
