Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Linked Excel worksheet

Posted on 1998-06-23
6
Medium Priority
?
195 Views
Last Modified: 2010-05-03
I have added a linked OLE object to a form and the source document is an Excel spreadsheet.  the spreadsheet is dynamic and will grow in length.  Can someone tell me how to have the rows set themselves automatically?  I need to set set a scrollable viewport for the data.  I tried adding a Vscrollbar to my form but all that does is scroll the entire OLE box.  How do I anchor the box and scroll the Data.
0
Comment
Question by:clarwc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 

Expert Comment

by:Ajoy
ID: 1464104
what you can do is  take the data fom the spreadsheet and display in dbcontrol grid which has the scroll bars.This should solve your problem.

0
 

Author Comment

by:clarwc
ID: 1464105
Ajoy,

Thanks, but I already have the Data in a FlexGrid but need to keep and Display it in a Spreadsheet as well.  How can I make the Vscroll bar scroll the data and not the entire OLE object.  T
0
 
LVL 1

Expert Comment

by:chdy
ID: 1464106
Option Explicit
Dim iSw&

Dim Xobj As Object
Dim XobjApp As Object

Dim A1%, B1%, C1%, D1%, E1%, F1%, G1%, H1%

Dim aCount%: Dim bCount%
Dim cCount%: Dim dCount%
Dim eCount%: Dim fCount%
Dim gCount%: Dim hCount%

Private Sub Form_Load()

Set Xobj = GetObject("c:\my documents\Data1.xls")
Xobj.Activate

End Sub

Private Sub chkStart_Click(value As Integer)

aCount = 0: bCount = 0
cCount = 0: dCount = 0
eCount = 0: fCount = 0
gCount = 0: hCount = 0

Xobj.Parent.Windows(1).Visible = True
Set XobjApp = Xobj.Application
XobjApp.Visible = True

If value = False Then
   
 Do
  DoEvents
 
  If chkStart.value = True Then
     Exit Do
  End If
   
  iSw = Int((8 * Rnd) + 1)      
  Debug.Print iSw

  Select Case iSw
         
         Case 1
              aCount = aCount + 1
              Xobj.Range("A4").value = aCount
             
         Case 2
              bCount = bCount + 1
              Xobj.Range("B4").value = bCount
         Case 3
              cCount = cCount + 1
              Xobj.Range("C4").value = cCount
         Case 4
              dCount = dCount + 1
              Xobj.Range("D4").value = dCount
         Case 5
              eCount = eCount + 1
              Xobj.Range("E4").value = eCount
         Case 6
              fCount = fCount + 1
              Xobj.Range("F4").value = fCount
         Case 7
              gCount = gCount + 1
              Xobj.Range("G4").value = gCount
         Case 8
              hCount = hCount + 1
              Xobj.Range("H4").value = hCount
     
     
      End Select

  Else
     chkStart.value = True
       
  End If

End Sub

Private Sub cmdStart_Click()
 Dim value As Boolean
   value = False
   chkStart_Click (value)
End Sub

I want to be content you....
Good Luck..  ^.^
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:clarwc
ID: 1464107
i notice in the sample you provided a start_click event.  Should I add a "Start" command button to my form that has the OLE object  and relate the code you provided to the command button's click event?
0
 

Author Comment

by:clarwc
ID: 1464108
chdy,

I inserted your code into the form containing my OLE object.  When I click the start button I got a "Else without if" error.

I commented out the following:

 If chkStart.value = True Then
         Exit Do
     
      'End If and then got a "do without loop" error.  I can't figure out what the loop argument should be or where it should go.  Sorry to ask such basic questions but I am VERY new to this.
0
 
LVL 1

Accepted Solution

by:
chdy earned 150 total points
ID: 1464109
Sorry !  clarwc...
 Select case iSw
        Case 1
            .
            .
            .

        Case 8
                     hCount = hCount + 1
                     Xobj.Range("H4").value = hCount
             
             
         End Select

         Loop  'This is the problem part
                   ' Sorry...^.^
         Else
            chkStart.value = True
               
         End If

       End Sub

 I'm Sorry. This case is My mistake about  Loop sentence ....
God blessing you.....
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question