Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call module after opening files (not working)

Status
Not open for further replies.

tudor30

Technical User
Jan 7, 2004
49
US
To clarify just in case it makes a difference...the textbox ECNN is from the control toolbox and sits on a worksheet. All of the modules running reports are just that...listed as modules.


This is the code from the worksheet. Can I call the modules after opening the file, extract the data, and close the file?

If so, the following code is opening the file but not calling the module.

*Note: I have commented out some items that I am not using in this test.

Option Explicit

Public Sub GetData_Click()
' Dim ECNN As String
' ECNN = ECNN.Text

' Range("A1").Value = ECNN.Text

Workbooks.OpenText Filename:= _
"\Frg1Sharedit_docsAPPSJDPS PDM ImpECN Reports Under ConstructionWork In ProgressProduction Test Files" & _
Trim$(ECNN.Text) & "D0_Face.xls", Origin:= _
xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _
Comma:=True, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), _
Array(2, 1))

Face_Page

End Sub

Thanks for suggestions,
John
 
I think you will need to run the macro using something like the following. I have found (not necessarily in this case) that some commands have problems processing string concatenation within their arguments, and it is better done first using a variable :-

MyMacro=Trim$(ECNN.Text) & "Do_Face.xls!Face_Page"
Application.Run(MyMacro)





Regards
BrianB
Use CupOfCoffee to speed up all windows applications
================================
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top