Solved

Print PDF to specific folder problem

Posted on 2013-11-05
7
435 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

738 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