473,396 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Code Assist

Hey All,

I am trying to get a macro set up to pull a specific .html file from a public drive, and put the data into an excel spreadsheet as a .txt file would. I used the text import wizard then tried to change the last part (date) of the file name to an asterisk so that it would pull the file no matter what the date was and I would not have to change it daily.

The asterisk was originally "02222007_0" which is the date of the file.

Does that makes sense?

Expand|Select|Wrap|Line Numbers
  1. Sub Macro2()
  2. ' Macro recorded 3/15/2007 by Matthew
  3. Sheets("data").Select
  4. Dim FileName As Variant
  5. FileName = Dir("C:\DC071\DC071_UNIXPRINT_*.HTML")
  6.  
  7.         With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & FileName, Destination:=Range("A1"))
  8.         .FileName =
  9.         .FieldNames = True
  10.         .RowNumbers = False
  11.         .FillAdjacentFormulas = False
  12.         .PreserveFormatting = True
  13.         .RefreshOnFileOpen = False
  14.         .RefreshStyle = xlOverwriteCells
  15.         .SavePassword = False
  16.         .SaveData = True
  17.         .AdjustColumnWidth = True
  18.         .RefreshPeriod = 0
  19.         .TextFilePromptOnRefresh = False
  20.         .TextFilePlatform = xlWindows
  21.         .TextFileStartRow = 24
  22.         .TextFileParseType = xlFixedWidth
  23.         .TextFileTextQualifier = xlTextQualifierDoubleQuote
  24.         .TextFileConsecutiveDelimiter = False
  25.         .TextFileTabDelimiter = True
  26.         .TextFileSemicolonDelimiter = False
  27.         .TextFileCommaDelimiter = False
  28.         .TextFileSpaceDelimiter = False
  29.         .TextFileColumnDataTypes = Array(1, 1, 1, 1)
  30.         .TextFileFixedColumnWidths = Array(34, 10, 11)
  31.  
  32.     End With
  33.     Sheets("data").Select
  34.     Range("B4").Select
  35.     With Selection.Interior
  36.         .ColorIndex = 1
  37.         .Pattern = xlSolid
  38.     End With
  39.     Range("D11").Select
  40. End Sub
Mar 16 '07 #1
1 949
Killer42
8,435 Expert 8TB
I do seem to recall that Dir( ) returns only the file name, without the path. So perhaps you are trying to open the correct filename from the wrong folder?
Mar 19 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: slaterjas | last post by:
We are running DB2 version 8.1.5. When we execute a query within SQL Assist we are only returned 200 rows. Is there a setting that we can change to increase this?? I can get more results if I...
15
by: Daniel Billingsley | last post by:
Speaking of trying to read deeply nested if-else blocks... I often find it's not always easy to tell one indent level from another (granted I keep my tab settings low so I'm not halfway across...
192
by: Vortex Soft | last post by:
http://www.junglecreatures.com/ Try it and tell me what's happenning in the Microsoft Corporation. Notes: VB, C# are CLS compliant
0
by: Mark Rance | last post by:
I recently bought Visual Assist and was quite disappointed to see how much it slows down the IDE for large solutions. It would also seem to hand the IDE such that I could no longer set focus to...
1
by: Marcin Balcerzak | last post by:
Hi, Not being an expert in Java (JRE 1.5) or Eclipse (3.1.1) I've encountered an intractable problems. Without apparent reason my Eclipse stopped: 1) Providing me content assist (shows "No...
1
by: Chris | last post by:
Hi, I am working on a small which involves a touchscreen and I need to create a on-screen keyboard. I need some assistance with a few questions 1. For the the buttons, do I user their text as...
1
by: Kelley McNeillie | last post by:
I am contacting you from a company called Software Specialists, an IT Placement Firm based in Pittsburgh, PA. We are prepared to make a donation to your organization if you could please help us out...
0
by: Pastororits | last post by:
Dear Beloved Brethren, Calvary greetings to you all in the name of Our Lord Jesus Christ. I am Pastor Isaac Orits Edah, 36 years old from Lagos Nigeria,married to Evangelist Faith Abosede, We are...
0
by: shergxewusrey | last post by:
crack express assist 8.0 http://cracks.12w.net F R E E
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.