LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Best Practice - Transfer Data

Hi there,
Thank you for your response to my questions.

Macro #2 seems to work pretty well for me, so I'm going to stick with it.
But there are a few glitches that I would like to fix before it can put to
use.

Here is the code:
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 2/17/2009 by Neon
'
' Keyboard Shortcut: Option+Cmd+z
'
ActiveSheet.Unprotect
ActiveSheet.Unprotect Password:="test"
Range("E11:F113").ClearContents

With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;Mac HD:Users:Neon:Desktop:report.csv",
Destination:=Range("E11"))
.Name = "report_6"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlMacintosh
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 1, 1, 9, 9, 9, _
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9)
.Refresh BackgroundQuery:=False
.UseListObject = False
End With

ActiveSheet.Protect
ActiveSheet.Protect Password:="test"
Range("D11").Select
End Sub

1. The code doesn't seem to register the Protect Password that I would like
it protect the sheet with. When I unprotect the sheet, there is NO password.
2. The Import Text File Wizard RESIZE the row height to FIT font size, how
can I avoid this?
3. Can anyone please help me modify the above codes, so that there is an
error message and an OK button pop up when report.csv file is not on the
desktop? (Error Handling purpose)

Thank you ,
Neon

" wrote:

Hi Neon,

You can edit Macro1 and specify a file name.

As and aside, regarding best practices: I always recommend *NOT* to
use copy and paste.

It's a killer on performance - it could make Excel hang for some
users.

Also, programmatically, it's easier because you know exactly how many
rows of data you've iterated through and you know exactly where to
start if you need to insert more data from another CSV.

I recommend that you iterate through the CSV a line at a time, but if
performance is *really* important, insert the data into the worksheet
in bursts of several rows at once instead of a row at a time.

 
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
Excel Data Protection Best Practice: AKA: Real Sheet Protection Mushman(Woof!)[_2_] Excel Discussion (Misc queries) 4 December 30th 09 01:20 AM
Transfer Excel data into Word, including text box data Sarah (OGI) Excel Discussion (Misc queries) 0 July 13th 07 10:06 AM
Activate Sheet Best Practice (Y/N?) when xFer data between sheets? [email protected] Excel Programming 2 July 3rd 07 04:52 PM
Transfer Data from Excel 2000 to the Access data base André Lavoie Excel Programming 1 September 28th 05 03:22 PM
Transfer data from XL into Access: best practice quartz[_2_] Excel Programming 2 June 24th 05 09:30 PM


All times are GMT +1. The time now is 07:29 PM.

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

About Us

"It's about Microsoft Excel"