Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / July 2006

Tip: Looking for answers? Try searching our database.

Need a Pause in a macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve - 20 Jul 2006 23:50 GMT
Hi,

I have a macro that goes out and retrieves data from a text file opened
with Excel, then pastes the data back in my worksheet and closes the
text file back up.  For some reason, the data that is being brought in
is being inserted in multiple columns because it is using a space
seperator now in lieu of a tab seperator.  Anyhow, if I go into my
macro and remove the part that closes the file I'm retrieving the data
from everything still works???  However, that file won't close.  Is
there a line that I can add to my macro to allow a pause for things to
get caught up before the workbook I'm retrieving the data from gets
closed?  TIA

For some reason this always worked as it was up until today.

Please advise,

Steve
Dave Peterson - 21 Jul 2006 13:51 GMT
How about something to test first?

Excel likes to remember the last settings used for Data|Text to columns (or via
the import wizard).

You can play with excel's memory by do a "dummy" text to columns--it should
reset the settings, so your real retrieval will work ok.

Option Explicit
Sub testme01()

   Dim wks As Worksheet
   Dim myCell As Range
   
   Set wks = Worksheets("sheet1")
   With wks
       Set myCell = .Cells.SpecialCells(xlCellTypeLastCell).Offset(1, 1)
   End With
   
   myCell.Value = "asdf"
   
   myCell.TextToColumns Destination:=myCell, _
       DataType:=xlDelimited, _
       TextQualifier:=xlDoubleQuote, _
       ConsecutiveDelimiter:=False, _
       Tab:=False, _
       Semicolon:=False, _
       Comma:=False, _
       Space:=False, _
       Other:=False, _
       FieldInfo:=Array(1, 1)
       
   myCell.ClearContents

End Sub

========
This memory usually screws me up when I've run data|text to columns, then copy
from a different application and try to paste to excel.  I'm not sure if it will
help you--I'm not sure how you retrieve the data.

> Hi,
>
[quoted text clipped - 14 lines]
>
> Steve

Signature

Dave Peterson

Steve - 24 Jul 2006 17:03 GMT
thanks, worked out fine

> How about something to test first?
>
[quoted text clipped - 55 lines]
> >
> > Steve

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.