Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mia Mia is offline
external usenet poster
 
Posts: 101
Default Looping and pdf-making

Hello,

I´m trying to make a looping code when I´m makin a pdf-file.
I can´t get i ringt, do anyone know whats wrong with my code bellow?
I´l be so grateful!

BR
Mia


Sub Skrivabevis2009pdf()
'
' Skriv Makro
' Makrot inspelat 2009-04-21 av Mia


Dim Start As Integer
Dim Stopp As Integer
Dim SkrivUt As String
Sheets("Uppföljning").Select
Start = Range("C7").Value
Stopp = Range("C8").Value


For i = Start To Stopp
Sheets("Kunddata").Select
Range("D9").Value = i
SkrivUt = Range("G9").Value
If SkrivUt = "S" Then

Dim Prewiev As String
Dim FilenameStr As String

If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE" _
& Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") < "" Then

FilenameStr = "M:\mo\S\bevis\" & _
ActiveSheet.Range("B10").Value & " " & Format(Now, "yyyy-mm-dd") &
".pdf"

Prewiev = "False"

Sheets("Uppföljning").Select
Sheets("Årsförnyelse 2009").Select

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



Sheets("Uppföljning").Select

End If

Next
Sheets("Uppföljning").Select

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Looping and pdf-making

Hi

Q1: What is the code supposed to do?
Q2: What DOES the code do?
Q3: Does the code create errors or just not do what you expect? If
errors, what are they? Is any line highlighted?

I doubt anyone will look at your code without some of this information
regards
Paul

On Apr 21, 10:33*am, Mia wrote:
Hello,

I´m trying to make a looping code when I´m makin a pdf-file.
I can´t get i ringt, do anyone know whats wrong with my code bellow?
I´l be so grateful!

BR
Mia

Sub Skrivabevis2009pdf()
'
' Skriv Makro
' Makrot inspelat 2009-04-21 av Mia

* * Dim Start As Integer
* * Dim Stopp As Integer
* * Dim SkrivUt As String
* * Sheets("Uppföljning").Select
* * Start = Range("C7").Value
* * Stopp = Range("C8").Value

* * For i = Start To Stopp
* * * * Sheets("Kunddata").Select
* * * * Range("D9").Value = i
* * * * SkrivUt = Range("G9").Value
* * * * If SkrivUt = "S" Then

* * * Dim Prewiev As String
* * * Dim FilenameStr As String

* * If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE" _
* * * * *& Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") < "" Then

* * * * FilenameStr = "M:\mo\S\bevis\" & _
* * * * ActiveSheet.Range("B10").Value & " " & Format(Now, "yyyy-mm-dd") &
".pdf"

* * * * Prewiev = "False"

Sheets("Uppföljning").Select
Sheets("Årsförnyelse 2009").Select

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

* *Sheets("Uppföljning").Select

* End If

* Next
* Sheets("Uppföljning").Select

End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
Mia Mia is offline
external usenet poster
 
Posts: 101
Default Looping and pdf-making

Thank you for your answer!

Q1 = I´m writing the same dokument from a list of persons, but only those
who have accepted.
Q2= So far, it does not do anything. If you want I can show you the code
that works for printing.
Q3=Komplimeringsfel - Next without for.

It´s not easy for me to try to explain in english, I hope you can understand
some.


//
Mia



" wrote:

Hi

Q1: What is the code supposed to do?
Q2: What DOES the code do?
Q3: Does the code create errors or just not do what you expect? If
errors, what are they? Is any line highlighted?

I doubt anyone will look at your code without some of this information
regards
Paul

On Apr 21, 10:33 am, Mia wrote:
Hello,

I´m trying to make a looping code when I´m makin a pdf-file.
I can´t get i ringt, do anyone know whats wrong with my code bellow?
I´l be so grateful!

BR
Mia

Sub Skrivabevis2009pdf()
'
' Skriv Makro
' Makrot inspelat 2009-04-21 av Mia

Dim Start As Integer
Dim Stopp As Integer
Dim SkrivUt As String
Sheets("Uppföljning").Select
Start = Range("C7").Value
Stopp = Range("C8").Value

For i = Start To Stopp
Sheets("Kunddata").Select
Range("D9").Value = i
SkrivUt = Range("G9").Value
If SkrivUt = "S" Then

Dim Prewiev As String
Dim FilenameStr As String

If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE" _
& Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") < "" Then

FilenameStr = "M:\mo\S\bevis\" & _
ActiveSheet.Range("B10").Value & " " & Format(Now, "yyyy-mm-dd") &
".pdf"

Prewiev = "False"

Sheets("Uppföljning").Select
Sheets("Årsförnyelse 2009").Select

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

Sheets("Uppföljning").Select

End If

Next
Sheets("Uppföljning").Select

End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Looping and pdf-making

Hi Mia

You are missing an End If statement, to be placed somewhere before the
"Next" statement.

Hopes this helps.

---
Per

On 21 Apr., 15:53, Mia wrote:
Thank you for your answer!

Q1 = I´m writing the same dokument from a list of persons, but only those
who have accepted.
Q2= So far, it does not do anything. If you want I can show you the code
that works for printing.
Q3=Komplimeringsfel - Next without for.

It´s not easy for me to try to explain in english, I hope you can understand
some.

//
Mia



" wrote:
Hi


Q1: What is the code supposed to do?
Q2: What DOES the code do?
Q3: Does the code create errors or just not do what you expect? If
errors, what are they? Is any line highlighted?


I doubt anyone will look at your code without some of this information
regards
Paul


On Apr 21, 10:33 am, Mia wrote:
Hello,


I´m trying to make a looping code when I´m makin a pdf-file.
I can´t get i ringt, do anyone know whats wrong with my code bellow?
I´l be so grateful!


BR
Mia


Sub Skrivabevis2009pdf()
'
' Skriv Makro
' Makrot inspelat 2009-04-21 av Mia


* * Dim Start As Integer
* * Dim Stopp As Integer
* * Dim SkrivUt As String
* * Sheets("Uppföljning").Select
* * Start = Range("C7").Value
* * Stopp = Range("C8").Value


* * For i = Start To Stopp
* * * * Sheets("Kunddata").Select
* * * * Range("D9").Value = i
* * * * SkrivUt = Range("G9").Value
* * * * If SkrivUt = "S" Then


* * * Dim Prewiev As String
* * * Dim FilenameStr As String


* * If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE" _
* * * * *& Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") < "" Then


* * * * FilenameStr = "M:\mo\S\bevis\" & _
* * * * ActiveSheet.Range("B10").Value & " " & Format(Now, "yyyy-mm-dd") &
".pdf"


* * * * Prewiev = "False"


Sheets("Uppföljning").Select
Sheets("Årsförnyelse 2009").Select


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


* *Sheets("Uppföljning").Select


* End If


* Next
* Sheets("Uppföljning").Select


End Sub- Skjul tekst i anførselstegn -


- Vis tekst i anførselstegn -


  #5   Report Post  
Posted to microsoft.public.excel.programming
Mia Mia is offline
external usenet poster
 
Posts: 101
Default Looping and pdf-making

Hi Per

You solved it, it works perfect!

Thank you so mutch!!! I´m wery grateful!

//
Mia


"Per Jessen" wrote:

Hi Mia

You are missing an End If statement, to be placed somewhere before the
"Next" statement.

Hopes this helps.

---
Per

On 21 Apr., 15:53, Mia wrote:
Thank you for your answer!

Q1 = I´m writing the same dokument from a list of persons, but only those
who have accepted.
Q2= So far, it does not do anything. If you want I can show you the code
that works for printing.
Q3=Komplimeringsfel - Next without for.

It´s not easy for me to try to explain in english, I hope you can understand
some.

//
Mia



" wrote:
Hi


Q1: What is the code supposed to do?
Q2: What DOES the code do?
Q3: Does the code create errors or just not do what you expect? If
errors, what are they? Is any line highlighted?


I doubt anyone will look at your code without some of this information
regards
Paul


On Apr 21, 10:33 am, Mia wrote:
Hello,


I´m trying to make a looping code when I´m makin a pdf-file.
I can´t get i ringt, do anyone know whats wrong with my code bellow?
I´l be so grateful!


BR
Mia


Sub Skrivabevis2009pdf()
'
' Skriv Makro
' Makrot inspelat 2009-04-21 av Mia


Dim Start As Integer
Dim Stopp As Integer
Dim SkrivUt As String
Sheets("Uppföljning").Select
Start = Range("C7").Value
Stopp = Range("C8").Value


For i = Start To Stopp
Sheets("Kunddata").Select
Range("D9").Value = i
SkrivUt = Range("G9").Value
If SkrivUt = "S" Then


Dim Prewiev As String
Dim FilenameStr As String


If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE" _
& Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") < "" Then


FilenameStr = "M:\mo\S\bevis\" & _
ActiveSheet.Range("B10").Value & " " & Format(Now, "yyyy-mm-dd") &
".pdf"


Prewiev = "False"


Sheets("Uppföljning").Select
Sheets("Årsförnyelse 2009").Select


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


Sheets("Uppföljning").Select


End If


Next
Sheets("Uppföljning").Select


End Sub- Skjul tekst i anførselstegn -


- Vis tekst i anførselstegn -



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making all past dates bold, looping Memento Excel Programming 2 September 24th 07 08:10 PM
Looping...but why? cherrynich Excel Programming 2 May 12th 06 04:57 PM
Help with Looping I think Mike Excel Programming 2 April 25th 06 04:23 PM
Looping Steve Excel Programming 2 September 9th 05 12:45 PM
Looping scottwilsonx[_52_] Excel Programming 1 October 5th 04 04:13 PM


All times are GMT +1. The time now is 04:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"