Solved

Print PDF to specific folder problem

Posted on 2013-11-05
7
433 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

770 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