Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Turn Off Auto-Format in Macro | Excel Programming | |||
Turn off auto redraw while updating chart format | Excel Programming | |||
How do you turn off pivot table auto format in Excel? | Excel Discussion (Misc queries) | |||
auto format - how do I turn it off? | Setting up and Configuration of Excel |