Data lost while importing from other documents

A

Anita

Hi,

I've got a Macro which is collecting data from all first sheets of all
xls documents in a certain folder. But doing this, text gets lost.
eg. I've got a cell containing the discription of a product, it's 296
characters (incl. spaces).
When I import the sheet info a new document using a Macro the cell
only contains 255 characters.

I'm using the following Macro:

Sub Products_verzamelen()
Dim basebook As Workbook
Dim mybook As Workbook
Dim sourceRange As Range
Dim destrange As Range
Dim FNames As String
Dim MyPath As String
Dim SaveDriveDir As String

SaveDriveDir = CurDir
MyPath = "HobbyHandig:Internet handelingen:products:" 'adapt it to
your folder
ChDrive MyPath
ChDir MyPath
FNames = Dir("", 0)
If Len(FNames) = 0 Then
MsgBox "No files in the Directory"
ChDrive SaveDriveDir
ChDir SaveDriveDir
Exit Sub
End If

Application.ScreenUpdating = False
Set basebook = ThisWorkbook
Do While FNames <> ""
Set mybook = Workbooks.Open(FNames)
mybook.Worksheets("Master").Copy After:= _
basebook.Sheets(basebook.Sheets.Count)
On Error Resume Next
ActiveSheet.Name = mybook.Name
On Error GoTo 0
' You can use this if you want to copy only the values
' With ActiveSheet.UsedRange
' .Value = .Value
' End With
mybook.Close False
FNames = Dir()
Loop
ChDrive SaveDriveDir
Application.ScreenUpdating = True
End Sub


Some people at this forum developed this for me, I don't really know
how Macro's work.

Can someone solve my problem?

Thanks in advance,

Anita
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top