Access 2000

Cameroncha

Registered User.
Local time
Today, 07:51
Joined
Jul 1, 2002
Messages
58
because of a problem with access cutting off memo fields after 255 characters, a user in this group made this script for me to solve the problem.

I saved it as a module called Excel256_fix and then try to run it i get an error this says "compile error, cant find module or library"

I searched and people in group talk about OLE object libraries under TOOLS/References but it is always grayed out. I am running Access 2000.

*******************************
Option Compare Database
Option Explicit

Private Sub Command1_Click()
Set xlApp = CreateObject("Excel.Application")
xlApp.Workbooks.Open "C:\FilePath.xls"
xlApp.Cells(1, 1).Select
xlApp.Visible = True
Dim MLength As Integer
Dim LoopNum As Integer
Dim i As Integer
Dim MPart As String
MLength = Len(Contents)
LoopNum = MLength / 255
For i = 0 To LoopNum
If i = 0 Then
MPart = Left(Contents, 255)
Else
MPart = Mid(Contents, 255 * i, 255)
End If
xlApp.Cells(i + 1, 1) = MPart

End Sub
*******************************

I dont know whats going on because i dont understand VB too well. Help ?
 
Private Sub Command1_Click()
Above means it was setup on a form behind a command button named Command1 on it's Click event.
xlApp.Workbooks.Open "C:\FilePath.xls"
It is opening a workbook called FilePath.xls on the root of a C: drive
MLength = Len(Contents)
It is looking for a variable, field, something in a text/string format called Contents, but I do not see it defined in this code.

You would have to make some changes I would think before you can use this.
 
contents is the field name in the form that has the onclick action to start the macro
 

Users who are viewing this thread

Back
Top Bottom