I have been fighting between Visual Basic and XLM approaches to create a macro that can open many similar fixed width text files that have no delimiters so i don't have to go through the tedious import wizard on every one.
i have got the macros working when i type in the path to the file but i cannot get a function that allows me to choose a file from a dialogue box.
visual basic keeps saying method failed when i try
[/CODE] myfile = Application.GetOpenFilename("Text Files,*.txt")Applications [/CODE]
(sorry for a forum that has rules you are supposed to set off code they seem to make it impossible to figure out how to do that. i can't find a glyphic to click or a FAQ that tells me how.)
throws the following error:
Run-time error '1004':
Method 'GetOpenFilename' of object '_Application' failed
I don't know where you find tutorials on syntax and parameters with Visual Basic calls such as GetOpenFilename (for instance i have no idea why it takes the prefix Application. and whether other prefixes are possible) although in the thread seeking help finding this solution on the visual basic side, someone offered me the code that is throwing the error.
and when i went back to my XLM documentation and tried OPEN.DIALOG() instead of getting a dialog box it seems to be making a call to open the active document and then returns an error because a document with the same name is already open.
anyone know a way around these problems.
thanks
brian
Bookmarks