Excel Macro - How do I "click a button" automatically

jen4950

[H]F Junkie
Joined
Apr 25, 2001
Messages
11,391
Hello-

Here's the macro:

Code:
Sub Auto_External_Data_Updater()
'
' Auto_Updater Macro
' Macro recorded 5/1/2006 by J. Neubauer
'

'
    Range("A4").Select
    With Selection.QueryTable
        .Connection = _
        Range("C1").Value
        .TextFilePlatform = 437
        .TextFileStartRow = 1
        .TextFileParseType = xlDelimited
        .TextFileTextQualifier = xlTextQualifierDoubleQuote
        .TextFileConsecutiveDelimiter = True
        .TextFileTabDelimiter = True
        .TextFileSemicolonDelimiter = False
        .TextFileCommaDelimiter = False
        .TextFileSpaceDelimiter = True
        .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
        .TextFileTrailingMinusNumbers = True
        .Refresh BackgroundQuery:=False
    End With
      
End Sub

What happens is the filename of the text file is automatically created and updated with this field (Cell B1 is updated in a different macro):

Code:
=CONCATENATE("TEXT;",IF(B1<10,"0",""),B1,".txt")

Which is actually created automatically from my analysis software.

The question is, once I run my auto-updater macro, it asks the question:

EXCEL_01.jpg


What code will press that Import button automatically?
 
Try adding this before your import code

Code:
DoCmd.SetWarnings False


And this after your code

Code:
DoCmd.SetWarnings True
 
Good idea- didn't work.

I also tried

Code:
SendKeys "%m"

Also a no-go..
 
Back
Top