Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Turn Off Auto-Format in Macro

Hey everyone,

I am currently working on a macro to import data from a text file using a
deliminator. I really don't have much (if any) access to the outputting
program to make changes, so everything needs to happen on my end.

What's happening is when I pull in the dimensions of lumber, excel is seeing
things such as "3-1/2" or "7/16" and autoformatting them to be a date like
"3/1/2002" or "16-July." This is a big problem for me because I need to know
the dimensions of my lumber to accurately assign item codes and pricing.
What I thought would be an easy fix was to shut off auto format for excel
while the macro is running, and as a last line of the macro i would enable
the macro back on.

I have been doing some searching and can't find much on macros and
auto-formatting. I know there are some good programmers here, so I'm hoping
one of you knows how to do this!

Thanks in advance,

Derek
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Turn Off Auto-Format in Macro

I sure can:

Sub Import()
FileName = Application.GetOpenFilename(FileFilter:="Text File (*.*),*.*")
If FileName = False Then
Exit Sub
End If
Workbooks.Add
'Import Text into sheet
Workbooks.OpenText FileName, Origin:=xlWindows, _
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=True _
, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 2), _
Array(2, 2), Array(3, 2), Array(4, 1), Array(5, 1), Array(6, 1))

End Sub

I haven't done anything with it since the import, due to the errors in the
formatting! I will upload the text file I import to
www.derekjohansen.com/sample.txt so if you want to see the formatting issue
i'm talking about you can test with that.

"r" wrote:

You can show your code?
thanks
regards
r

Il mio ultimo lavoro ...
http://excelvba.altervista.org/blog/...ternative.html


"Derek Johansen" wrote:

Hey everyone,

I am currently working on a macro to import data from a text file using a
deliminator. I really don't have much (if any) access to the outputting
program to make changes, so everything needs to happen on my end.

What's happening is when I pull in the dimensions of lumber, excel is seeing
things such as "3-1/2" or "7/16" and autoformatting them to be a date like
"3/1/2002" or "16-July." This is a big problem for me because I need to know
the dimensions of my lumber to accurately assign item codes and pricing.
What I thought would be an easy fix was to shut off auto format for excel
while the macro is running, and as a last line of the macro i would enable
the macro back on.

I have been doing some searching and can't find much on macros and
auto-formatting. I know there are some good programmers here, so I'm hoping
one of you knows how to do this!

Thanks in advance,

Derek

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
Turn Off Auto-Format in Macro r Excel Programming 0 June 12th 09 10:59 PM
Turn off auto redraw while updating chart format Charles in Iraq Excel Programming 1 April 2nd 07 09:01 AM
How do you turn off pivot table auto format in Excel? srudd Excel Discussion (Misc queries) 3 November 30th 05 04:35 AM
auto format - how do I turn it off? TooManyPutters Setting up and Configuration of Excel 1 July 13th 05 05:19 PM


All times are GMT +1. The time now is 08:15 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"