Solved

Linked Excel worksheet

Posted on 1998-06-23
6
176 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
  • 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

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 50 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now