Jump to content

Excel Help...Please


 Share

Recommended Posts

:)

Hi to all you fantastic Autoit script guru's..

I need help to finnish a script I've have done for our domain users, in short we dont want local domain users to have access to the local drive on the workstation, how ever the main application dumps text files to the local applications directory on reports requried by the user.

So far I have a GUI which allows the user to select the file required and open this in Excel / Word / Notepad 0r Email.

My problem is that it needs be opened in excel via Text Import Wizard so that the user can control the excel worksheet. Changing the text file does not work as well as using the wizard.

Below is a excel macro we use to do the job but I want to do all via the one GUI.

Please help....

:whistle:

'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Sub ImportTextUsingXlDialogOpen()

'\ use this approach to prompt user for text wizard values

Application.ScreenUpdating = False

Application.DisplayAlerts = False

'\ display open file dialog and copy to new (temporary workbook)

'On error resume next - traps for user clicking cancel in the import dialog

'Error number is 1004 - is so exit the procedure

On Error Resume Next

If Application.Dialogs(xlDialogOpen).Show("C:\Magix\*.txt") Then

If Err.Number = 1004 Then

Exit Sub

End If

ActiveSheet.UsedRange.Select '\ select imported text in temporary workbook

Selection.Copy '\ copy to clipboard

ActiveWorkbook.Close '\ close temporary workbook

Worksheets.Add

Range("A1") = "Dialogs(xlDialogOpen) Method"

Range("A2").Select

ActiveSheet.Paste '\ paste text into your workbook

End If

Application.ScreenUpdating = True

Application.DisplayAlerts = True

End Sub

'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...