Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Works in 2000 not in 2003?

Hello,

The following code is extracted from a larger routine which purpor is to
print/convert an xls into a pdf.

sFileFullname = Mid(strFilename, InStrRev(strFilename, "\") + 1, 255)
'get full filename
sFileName = Left(sFileFullname, Len(sFileFullname) - 4) 'File Name
sExtension = Right(sFileFullname, 3) 'File Extension
sPath = Left(strFilename, InStrRev(strFilename, "\")) 'get path

PSFileName = sPath & sFileName & ".ps"
PDFFileName = sPath & sFileName & ".pdf"

Set objApp = CreateObject("Excel.Application")
With objApp
Application.Cursor = xlWait
.Visible = True
Set sSheet = Workbooks.Open(Sheets("parameters").Range("A250"))
End With

Dim MySheet As Worksheet
Set MySheet = ActiveSheet

'Select the PDF printer
MsgBox "Please select your Acrobat Printer from the available list of
printers", , "Which printer is your PDF Printer?"
bPrntSel = Application.Dialogs(xlDialogPrinterSetup).Show
' Application.Visible = False

'Create the PostScript File
If bPrntSel Then
MySheet.PrintOut ActivePrinter:=ActivePrinter, PrintToFile:=True,
PrToFileName:=PSFileName
'...continues on

It works beautifully in Excel 2000, but always generate a 1004 error in 2003
at the MySheet.PrintOut ..... line (Your file could not be printed due to an
error on ...: There are several possible reasons (not enough memory, network
printer etc€¦))?! Any advice would be greatly appreciated.

Thank you,

QB
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Works in 2000 not in 2003?

It looks like the probem is a missing line continuation character

MySheet.PrintOut ActivePrinter:=ActivePrinter, _
PrintToFile:=True, _
PrToFileName:=PSFileName


"Question Boy" wrote:

Hello,

The following code is extracted from a larger routine which purpor is to
print/convert an xls into a pdf.

sFileFullname = Mid(strFilename, InStrRev(strFilename, "\") + 1, 255)
'get full filename
sFileName = Left(sFileFullname, Len(sFileFullname) - 4) 'File Name
sExtension = Right(sFileFullname, 3) 'File Extension
sPath = Left(strFilename, InStrRev(strFilename, "\")) 'get path

PSFileName = sPath & sFileName & ".ps"
PDFFileName = sPath & sFileName & ".pdf"

Set objApp = CreateObject("Excel.Application")
With objApp
Application.Cursor = xlWait
.Visible = True
Set sSheet = Workbooks.Open(Sheets("parameters").Range("A250"))
End With

Dim MySheet As Worksheet
Set MySheet = ActiveSheet

'Select the PDF printer
MsgBox "Please select your Acrobat Printer from the available list of
printers", , "Which printer is your PDF Printer?"
bPrntSel = Application.Dialogs(xlDialogPrinterSetup).Show
' Application.Visible = False

'Create the PostScript File
If bPrntSel Then
MySheet.PrintOut ActivePrinter:=ActivePrinter, PrintToFile:=True,
PrToFileName:=PSFileName
'...continues on

It works beautifully in Excel 2000, but always generate a 1004 error in 2003
at the MySheet.PrintOut ..... line (Your file could not be printed due to an
error on ...: There are several possible reasons (not enough memory, network
printer etc€¦))?! Any advice would be greatly appreciated.

Thank you,

QB

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Works in 2000 not in 2003?

Joel,

It is actually all on 1 line, it is simply the line wrapping from the forum.

I can't get it to print to a file? It doesn't even get to the pdf
conversion part of my code. Are there any changes between 2000 and 2003 that
would break the PrintOut Method?

Any other advice?

QB




"Joel" wrote:

It looks like the probem is a missing line continuation character

MySheet.PrintOut ActivePrinter:=ActivePrinter, _
PrintToFile:=True, _
PrToFileName:=PSFileName


"Question Boy" wrote:

Hello,

The following code is extracted from a larger routine which purpor is to
print/convert an xls into a pdf.

sFileFullname = Mid(strFilename, InStrRev(strFilename, "\") + 1, 255)
'get full filename
sFileName = Left(sFileFullname, Len(sFileFullname) - 4) 'File Name
sExtension = Right(sFileFullname, 3) 'File Extension
sPath = Left(strFilename, InStrRev(strFilename, "\")) 'get path

PSFileName = sPath & sFileName & ".ps"
PDFFileName = sPath & sFileName & ".pdf"

Set objApp = CreateObject("Excel.Application")
With objApp
Application.Cursor = xlWait
.Visible = True
Set sSheet = Workbooks.Open(Sheets("parameters").Range("A250"))
End With

Dim MySheet As Worksheet
Set MySheet = ActiveSheet

'Select the PDF printer
MsgBox "Please select your Acrobat Printer from the available list of
printers", , "Which printer is your PDF Printer?"
bPrntSel = Application.Dialogs(xlDialogPrinterSetup).Show
' Application.Visible = False

'Create the PostScript File
If bPrntSel Then
MySheet.PrintOut ActivePrinter:=ActivePrinter, PrintToFile:=True,
PrToFileName:=PSFileName
'...continues on

It works beautifully in Excel 2000, but always generate a 1004 error in 2003
at the MySheet.PrintOut ..... line (Your file could not be printed due to an
error on ...: There are several possible reasons (not enough memory, network
printer etc€¦))?! Any advice would be greatly appreciated.

Thank you,

QB

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Works in 2000 not in 2003?

Question Boy wrote:
Hello,

The following code is extracted from a larger routine which purpor is to
print/convert an xls into a pdf.

sFileFullname = Mid(strFilename, InStrRev(strFilename, "\") + 1, 255)
'get full filename
sFileName = Left(sFileFullname, Len(sFileFullname) - 4) 'File Name
sExtension = Right(sFileFullname, 3) 'File Extension
sPath = Left(strFilename, InStrRev(strFilename, "\")) 'get path

PSFileName = sPath & sFileName & ".ps"
PDFFileName = sPath & sFileName & ".pdf"

Set objApp = CreateObject("Excel.Application")
With objApp
Application.Cursor = xlWait
.Visible = True
Set sSheet = Workbooks.Open(Sheets("parameters").Range("A250"))
End With

Dim MySheet As Worksheet
Set MySheet = ActiveSheet

'Select the PDF printer
MsgBox "Please select your Acrobat Printer from the available list of
printers", , "Which printer is your PDF Printer?"
bPrntSel = Application.Dialogs(xlDialogPrinterSetup).Show
' Application.Visible = False

'Create the PostScript File
If bPrntSel Then
MySheet.PrintOut ActivePrinter:=ActivePrinter, PrintToFile:=True,
PrToFileName:=PSFileName
'...continues on

It works beautifully in Excel 2000, but always generate a 1004 error in 2003
at the MySheet.PrintOut ..... line (Your file could not be printed due to an
error on ...: There are several possible reasons (not enough memory, network
printer etc€¦))?! Any advice would be greatly appreciated.

Thank you,

QB



I think that I would record a test Macro for just the bit that prints to PDF,
and then compare the recorded Macro to your existing one

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200803/1

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Works in 2000 not in 2003?

The following code works without errors

PSFileName = "abc.txt"


Dim MySheet As Worksheet
Set MySheet = ActiveSheet

'Select the PDF printer
MsgBox "Please select your Acrobat Printer from the available list of
printers", , _
"Which printer is your PDF Printer?"
bPrntSel = Application.Dialogs(xlDialogPrinterSetup).Show
' Application.Visible = False

MySheet.PrintOut ActivePrinter:=ActivePrinter, PrintToFile:=True,
PrToFileName:=PSFileName

Maybe the printer you are selecting doesn't have a printtofile option?

"Question Boy" wrote:

Joel,

It is actually all on 1 line, it is simply the line wrapping from the forum.

I can't get it to print to a file? It doesn't even get to the pdf
conversion part of my code. Are there any changes between 2000 and 2003 that
would break the PrintOut Method?

Any other advice?

QB




"Joel" wrote:

It looks like the probem is a missing line continuation character

MySheet.PrintOut ActivePrinter:=ActivePrinter, _
PrintToFile:=True, _
PrToFileName:=PSFileName


"Question Boy" wrote:

Hello,

The following code is extracted from a larger routine which purpor is to
print/convert an xls into a pdf.

sFileFullname = Mid(strFilename, InStrRev(strFilename, "\") + 1, 255)
'get full filename
sFileName = Left(sFileFullname, Len(sFileFullname) - 4) 'File Name
sExtension = Right(sFileFullname, 3) 'File Extension
sPath = Left(strFilename, InStrRev(strFilename, "\")) 'get path

PSFileName = sPath & sFileName & ".ps"
PDFFileName = sPath & sFileName & ".pdf"

Set objApp = CreateObject("Excel.Application")
With objApp
Application.Cursor = xlWait
.Visible = True
Set sSheet = Workbooks.Open(Sheets("parameters").Range("A250"))
End With

Dim MySheet As Worksheet
Set MySheet = ActiveSheet

'Select the PDF printer
MsgBox "Please select your Acrobat Printer from the available list of
printers", , "Which printer is your PDF Printer?"
bPrntSel = Application.Dialogs(xlDialogPrinterSetup).Show
' Application.Visible = False

'Create the PostScript File
If bPrntSel Then
MySheet.PrintOut ActivePrinter:=ActivePrinter, PrintToFile:=True,
PrToFileName:=PSFileName
'...continues on

It works beautifully in Excel 2000, but always generate a 1004 error in 2003
at the MySheet.PrintOut ..... line (Your file could not be printed due to an
error on ...: There are several possible reasons (not enough memory, network
printer etc€¦))?! Any advice would be greatly appreciated.

Thank you,

QB

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
Sort works in 2003 but not in 2000 Gleam Excel Programming 4 October 15th 07 09:30 PM
Object works in Excel 2000 but not in 2003 IBTrini Excel Programming 2 March 28th 07 03:01 AM
external data works in 2003 not in 2000 mikeolson Excel Programming 2 March 13th 07 01:14 PM
VB Code works in 2000, but not 2003 [email protected] Excel Programming 2 June 21st 06 09:13 AM
Why 'Unprotect' works for 2003 but not 2000?! OrientalPearl Excel Programming 13 April 3rd 06 01:44 AM


All times are GMT +1. The time now is 06:00 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"