?
Solved

Print PDF to specific folder problem

Posted on 2013-11-05
7
Medium Priority
?
437 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 1000 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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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…
Suggested Courses

741 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