Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Importing Excel Sheet Problem

Hi,

I am trying to import an excel sheet into an excel file. It works,
however, cells that are more than 255 chars are cutting off...here is
the code I am using...Please help!!!

'*********************IMPORT EXCEL FILE*********************
Dim Count As Integer
Dim Response As Variant

'***************New Code TO Extract**********************
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim CurrentWB As Excel.Workbook
Dim FileName As Variant


FileName = Application.GetOpenFilename _
(filefilter:="Excel Workbook(*.xls),*.txt,All
Files(*.*),*.*")
If FileName = False Then
MsgBox "You did not select a file."
Sheets("Setup").Select
Exit Sub
End If


Application.ScreenUpdating = False
Sheets("RawData").Select
Cells.Select
Selection.ClearContents
Set CurrentWB = ThisWorkbook
Set xlBook = Workbooks.Open(FileName, False, True)
Set xlSheet = xlBook.Worksheets(1)
xlSheet.Copy after:=CurrentWB.Sheets(CurrentWB.Sheets.Count)
xlBook.Close savechanges:=False
'Application.ScreenUpdating = True
CurrentWB.Sheets(CurrentWB.Sheets.Count).Select
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Sheets("RawData").Select
Cells.Select
ActiveSheet.Paste
Columns("A:Z").EntireColumn.AutoFit
Application.DisplayAlerts = False
Worksheets(CurrentWB.Sheets.Count).Delete
Application.DisplayAlerts = True

Set xlSheet = Nothing
Set xlBook = Nothing
Set CurrentWB = Nothing
'*********************IMPORT EXCEL FILE*********************

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Importing Excel Sheet Problem

This might be on point:

http://support.microsoft.com/kb/213548/en-us


--
Jim
"Mo" wrote in message
ups.com...
| Hi,
|
| I am trying to import an excel sheet into an excel file. It works,
| however, cells that are more than 255 chars are cutting off...here is
| the code I am using...Please help!!!
|
| '*********************IMPORT EXCEL FILE*********************
| Dim Count As Integer
| Dim Response As Variant
|
| '***************New Code TO Extract**********************
| Dim xlBook As Excel.Workbook
| Dim xlSheet As Excel.Worksheet
| Dim CurrentWB As Excel.Workbook
| Dim FileName As Variant
|
|
| FileName = Application.GetOpenFilename _
| (filefilter:="Excel Workbook(*.xls),*.txt,All
| Files(*.*),*.*")
| If FileName = False Then
| MsgBox "You did not select a file."
| Sheets("Setup").Select
| Exit Sub
| End If
|
|
| Application.ScreenUpdating = False
| Sheets("RawData").Select
| Cells.Select
| Selection.ClearContents
| Set CurrentWB = ThisWorkbook
| Set xlBook = Workbooks.Open(FileName, False, True)
| Set xlSheet = xlBook.Worksheets(1)
| xlSheet.Copy after:=CurrentWB.Sheets(CurrentWB.Sheets.Count)
| xlBook.Close savechanges:=False
| 'Application.ScreenUpdating = True
| CurrentWB.Sheets(CurrentWB.Sheets.Count).Select
| Cells.Select
| Application.CutCopyMode = False
| Selection.Copy
| Sheets("RawData").Select
| Cells.Select
| ActiveSheet.Paste
| Columns("A:Z").EntireColumn.AutoFit
| Application.DisplayAlerts = False
| Worksheets(CurrentWB.Sheets.Count).Delete
| Application.DisplayAlerts = True
|
| Set xlSheet = Nothing
| Set xlBook = Nothing
| Set CurrentWB = Nothing
| '*********************IMPORT EXCEL FILE*********************
|


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird Problem while Importing Data into another sheet Sundar Excel Discussion (Misc queries) 0 July 2nd 08 04:50 PM
Problem importing Excel to Access Oregonnews Excel Worksheet Functions 3 April 23rd 07 09:37 PM
Importing excel sheet Viju Gopal Excel Discussion (Misc queries) 0 August 31st 06 05:47 PM
Importing from Excel Sheet Problem workerboy Excel Discussion (Misc queries) 0 August 18th 06 02:44 PM
Problem importing to Excel MLT Excel Discussion (Misc queries) 0 July 13th 05 01:09 PM


All times are GMT +1. The time now is 01:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"