Solved

Linked Excel worksheet

Posted on 1998-06-23
6
192 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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
Course of the Month5 days, 22 hours left to enroll

626 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