Home > Software engineering >  A pile of excel file, freedom of choice to print file????
A pile of excel file, freedom of choice to print file????

Time:11-22

iterates through all files, folders and batch printing, I can do it, such as A folder with files, A file B, C, D file, the file E, file F, I might choose the print files, A file B, or print, the code how to write?

This is excel print range, select the default printer
Range (" A1: Z33 "). Select
Selection. The PrintOut Copies:=1, Collate:=True
Sheets (" positioning measurement acceptance records "). Select
Range (" A1: Z29 "). Select
Selection. The PrintOut Copies:=1, Collate:=True
Results Sheets (" table "). Select
Range (" A1: L16 "). Select
Selection. The PrintOut Copies:=1, Collate:=True
Sheets (" axis floor reiteration "). Select
Range (" A1: AM23 "). Select
Selection. The PrintOut Copies:=1, Collate:=True
Sheets (" handover records "). Select
Range (" A1: L29). Select
Selection. The PrintOut Copies:=1, Collate:=True

CodePudding user response:

Before you do it is iterate through all the files, and then play a search to a file,
Slightly altered, iterate through all the files, the path and file name on a list of all files or listview or simply thrown into a sheet, it is a to check the list, and then checked by operating personnel want to print the file, then traverse the list file to print to be checked,
And the difference is just before you traverse the file needs to be secondary to confirm

CodePudding user response:

Quote: reference 1/f, crispy big ice cream reply:

First of all thank you very much for your reply, but this code "can be checked" can you give an example?

CodePudding user response:

[administrator] DTer | system automatic speech please do not reply 2019/4/22 15:47:34
The checkbox???

CodePudding user response:

Put a listbox, new form, paste the following code
Form after the start list list file, select the check the file, and then click form at any position, immediately show you select files in the form

 
Private Sub UserForm_Initialize ()

Dim strTmp As String
Me. The ListBox1. ListStyle=fmListStyleOption
Me. The ListBox1. MultiSelect=fmMultiSelectMulti

StrTmp=Dir (" C: \ Windows \ ")
The Do While strTmp & lt;> "
"ListBox1. AddItem strTmp
StrTmp=Dir
Loop
End Sub



Private Sub UserForm_Click ()
Dim As Integer I
For I=0 To Me. The ListBox1. ListCount - 1
If ListBox1. Selected (I) Then Debug. Print ListBox1. List (I)
Next
End Sub
  •  Tags:  
  • VBA
  • Related