Solved

Print PDF to specific folder problem

Posted on 2013-11-05
7
431 Views
Last Modified: 2013-11-21
I want my code to print the pdf to a folder named

P:\PC Amager\DATA - målstyringsmøder på ALLE afsnit\Amb_Team1\Aflysninger\Filename.pdf

instead it ends up in the folder

P:\PC Amager\DATA - målstyringsmøder på ALLE afsnit\Amb_Team1\Filename.pdf

Can some one please help me. Thx in advance.

My current code is

Sub printPDF(filnavn As String)

    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
    Filename:=filnavn, _
    Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, _
    IgnorePrintAreas:=False, _
    OpenAfterPublish:=False

End Sub

Sub udskrivSide(speciale As String, ark As String, tavlenavn, destination)

Dim N As Date
Dim T As String
N = Now()
T = Format(N, "dd-mm-yyyy ")

Sheets(ark).Select

Sheets("Indstillinger").Cells(5, 3) = speciale

Call RullemenuSpecialer_Ændring

Call printPDF(destination & "\" & tavlenavn & "\" & mappe & "\" & T & tavlenavn & " _
" & mappe)

End Sub
------------

Sub udskrivAlle()

Dim destination As String
Dim tavlenavn As String
Dim mappe As String

destination = "P:\PC Amager\DATA - målstyringsmøder på ALLE afsnit\"

Application.ScreenUpdating = False

mappe = "Aflysninger"

Call udskrivSide(1, "Graf - Aflysninger", "AMB_Team1", destination)

Application.ScreenUpdating = True

End Sub

Open in new window

0
Comment
Question by:LarsDyrby
  • 3
  • 2
7 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 39624313
Change your second sub to this:


Sub udskrivAlle()

Dim destination As String
Dim tavlenavn As String
Dim mappe As String

destination = "P:\PC Amager\DATA - målstyringsmøder på ALLE afsnit\"

Application.ScreenUpdating = False

mappe = "Aflysninger"

Call udskrivSide(1, "Graf - Aflysninger", "AMB_Team1\Aflysninger", destination)

Application.ScreenUpdating = True

End Sub

Open in new window

0
 
LVL 61

Accepted Solution

by:
mbizup earned 250 total points
ID: 39624336
Or perhaps this.  (You need to pass mappe to the sub that saves the file:


Sub printPDF(filnavn As String)

    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
    Filename:=filnavn, _
    Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, _
    IgnorePrintAreas:=False, _
    OpenAfterPublish:=False

End Sub

Sub udskrivSide(speciale As String, ark As String, tavlenavn as string, destination as string, mappe as string)

Dim N As Date
Dim T As String
N = Now()
T = Format(N, "dd-mm-yyyy ")

Sheets(ark).Select

Sheets("Indstillinger").Cells(5, 3) = speciale

Call RullemenuSpecialer_Ændring

Call printPDF(destination & "\" & tavlenavn & "\" & mappe & "\" & T & tavlenavn & " _
" & mappe)

End Sub
------------

Sub udskrivAlle()

Dim destination As String
Dim tavlenavn As String
Dim mappe As String

destination = "P:\PC Amager\DATA - målstyringsmøder på ALLE afsnit\"

Application.ScreenUpdating = False

mappe = "Aflysninger"

Call udskrivSide(1, "Graf - Aflysninger", "AMB_Team1", destination, mappe)

Application.ScreenUpdating = True

End Sub

Open in new window

0
 

Author Comment

by:LarsDyrby
ID: 39629881
Thx, works perfect.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39629888
Lars,

If it works perfectly, why did you grade it with a "B" without asking for any more detail?

B's and C's here are grading 'penalties' which lower the points received by the people helping you.  They are appropriate in cases where the responses didn't completely resolve the issue or where you didn't receive adequate follow-up:
http://support.experts-exchange.com/customer/portal/articles/481419-what-grade-should-i-award-?b_id=44
0
 

Author Comment

by:LarsDyrby
ID: 39633060
I see your point - I didn't know that the grading affected the points.

Is there anyway I can correct the grading?
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now