ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Importing .PRN files into Excel spreadsheet (https://www.excelbanter.com/excel-programming/375089-importing-prn-files-into-excel-spreadsheet.html)

[email protected]

Importing .PRN files into Excel spreadsheet
 
Is there a way to import .PRN files into Excel Spreadsheet
automatically? I have tried recording macros and then tried to save it.
it did not work. I want to set up a button where you can just click it
and it will let you open .PRN files and then does everything
automatically.

Much appreciated!
-DR


Dave Peterson

Importing .PRN files into Excel spreadsheet
 
I like to create a dedicated macro workbook that contains the code. And then I
put a big button from the Forms toolbar on the only worksheet in that workbook.
I'll add a few instructions to that sheet, too.

I'd tweak the code to get the name of the file to open from the user and then
include code that adds some more stuff--like formatting, filters, subtotals,
page setup (headers/footers/rows to repeat at top/etc).

Then it actually becomes a tool that makes life a lot easier.

My tweaked code could look a little like:

Option Explicit
Sub Testme01()

Dim myFileName As Variant

myFileName = Application.GetOpenFilename(filefilter:="Prn Files, *.PRN", _
Title:="Pick a File")

If myFileName = False Then
MsgBox "Ok, try later" 'user hit cancel
Exit Sub
End If

Workbooks.OpenText Filename:=myFileName '....rest of recorded code here!

End Sub

wrote:

Is there a way to import .PRN files into Excel Spreadsheet
automatically? I have tried recording macros and then tried to save it.
it did not work. I want to set up a button where you can just click it
and it will let you open .PRN files and then does everything
automatically.

Much appreciated!
-DR


--

Dave Peterson

[email protected]

Importing .PRN files into Excel spreadsheet
 
Thank you so much for your help.... It works fine..

Once again Thanks.

Dave Peterson wrote:
I like to create a dedicated macro workbook that contains the code. And then I
put a big button from the Forms toolbar on the only worksheet in that workbook.
I'll add a few instructions to that sheet, too.

I'd tweak the code to get the name of the file to open from the user and then
include code that adds some more stuff--like formatting, filters, subtotals,
page setup (headers/footers/rows to repeat at top/etc).

Then it actually becomes a tool that makes life a lot easier.

My tweaked code could look a little like:

Option Explicit
Sub Testme01()

Dim myFileName As Variant

myFileName = Application.GetOpenFilename(filefilter:="Prn Files, *.PRN", _
Title:="Pick a File")

If myFileName = False Then
MsgBox "Ok, try later" 'user hit cancel
Exit Sub
End If

Workbooks.OpenText Filename:=myFileName '....rest of recorded code here!

End Sub

wrote:

Is there a way to import .PRN files into Excel Spreadsheet
automatically? I have tried recording macros and then tried to save it.
it did not work. I want to set up a button where you can just click it
and it will let you open .PRN files and then does everything
automatically.

Much appreciated!
-DR


--

Dave Peterson




All times are GMT +1. The time now is 06:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com