Creating File #1, Saving File #1 to Folder #1, Then Incrementing & Repeating

djicenine

New Member
Joined
Mar 16, 2016
Messages
10
Hi there,

I have an excel macro that creates Bingo Cards that works lie this:

I run the macro
A dialog box asks how many I want to create
Another dialog box asks me what I want to name the card
Then it creates the card, names it and saves it as a pdf in a specified folder (one that I created ahead of time)

This loops for as many cards as I chose, refreshing the values that appear on the card each time, so they are unique cards.

Bingo Game - Card 1.pdf
Bingo Game - Card 2.pdf
Bingo Game - Card 3.pdf etc

I have created a group of folders named "Folder 1" thru "Folder 100", and I would like to have the macro create a card named "Card 1", save it to "Folder 1", then loop through until "Card 100" is in "Folder 100", with each card saved in its proper folder.

Below is the macro I use. If anyone could help with a solution, that would be fantastic!

Thanks!
Patrick

Sub BingoPrintPDF()

Dim x As Integer
Dim y As String
Dim num As Integer

' Refresh page and print x number of times
Application.ScreenUpdating = False
x = InputBox("How many sheets do you require printing?", "Total To Print ?")
y = InputBox("What is the name of your Music Bingo Round?")
Z = " - Card "
For num = 1 To x
Calculate

'Amend the range to reflect your bingo card
Sheet2.Range("B3:H16").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"D:\Dropbox\Dropbox\0 AA\" & y & " " & Z & num & ".pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Next num
Application.ScreenUpdating = True

End Sub
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Try this, check the initial folder: "D:\Dropbox\Dropbox\0 AA\"


VBA Code:
Sub BingoPrintPDF()
  Dim x As Integer, num As Integer
  Dim y As String, z As String, sFolder As String
  ' Refresh page and print x number of times
  Application.ScreenUpdating = False
  x = InputBox("How many sheets do you require printing?", "Total To Print ?")
  y = InputBox("What is the name of your Music Bingo Round?")
  z = " - Card "
  For num = 1 To x
    Calculate
    'Amend the range to reflect your bingo card
    sFolder = "D:\Dropbox\Dropbox\0 AA\" & "Folder " & num & "\"
    Sheet2.Range("B3:H16").ExportAsFixedFormat Type:=xlTypePDF, _
      Filename:=sFolder & y & " " & z & num & ".pdf", _
      Quality:=xlQualityStandard, IncludeDocProperties:=True, _
      IgnorePrintAreas:=False, OpenAfterPublish:=False
  Next num
  Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thank you so much, Dante! This worked perfectly! You just save my life, man! Much appreciated!

Stay healthy & safe! Take care.

Patrick
 
Upvote 0
I'm glad to help you. Thanks for the feedback.
I also wish you the best for you and your family.
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top