Solved

Print PDF to specific folder problem

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
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…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

910 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

16 Experts available now in Live!

Get 1:1 Help Now