View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.programming
medic medic is offline
external usenet poster
 
Posts: 10
Default how do i create a macro that will print and save my file to sh

the macro editor is not immediatly going red anymore but when i click the
button the macro is asigned to I get a run time error --here is the code i
have now.
Sub saveandprint()
'
' saveandprint Macro
'

'
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _

"http://companyweb/General%20Documents/Insurance%20stuff/Patient%20OON%20bills/" & Range("d1").Value _
, Quality:=xlQualityMinimum, IncludeDocProperties:=True,
IgnorePrintAreas _
:=False, From:=1, To:=1, OpenAfterPublish:=False
ExecuteExcel4Macro "PRINT(2,1,1,1,,,,,,,,2,,,TRUE,,FALSE)"
End Sub

Thanks




"JP" wrote:

It looks like you aren't closing the string with a closing quotation
mark.

i.e.

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"http://companyweb/General%20Documents/Insurance%20stuff/Patient%20OON
%20bills/" & Range("D1").Value


It was there in your previous posts.

HTH,
JP

On Jan 8, 6:16 pm, medic wrote:
getting a "Compile error: expected end of statement" here is what i now have:

Sub saveandprint()
'
' saveandprint Macro
'

'
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _

"http://companyweb/General%20Documents/Insurance%20stuff/Patient%20OON...& Range("d1").Value _

, Quality:=xlQualityMinimum, IncludeDocProperties:=True,
IgnorePrintAreas _
:=False, From:=1, To:=1, OpenAfterPublish:=False
ExecuteExcel4Macro "PRINT(2,1,1,1,,,,,,,,2,,,TRUE,,FALSE)"
End Sub



"JP" wrote:
There has to be a space before the "& Range("A1").Value" part.


HTH,
JP


On Jan 8, 10:45 am, medic wrote:
here is what i have -- getting a syntex error:
Sub saveandprint()
'
' saveandprint Macro
'


'
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _


"http://companyweb/General%20Documents/Insurance%20stuff/Patient%20OON....("A1").Value _


, Quality:=xlQualityMinimum, IncludeDocProperties:=True,
IgnorePrintAreas _
:=False, From:=1, To:=1, OpenAfterPublish:=False
ExecuteExcel4Macro "PRINT(2,1,1,1,,,,,,,,2,,,TRUE,,FALSE)"
End Sub- Hide quoted text -


- Show quoted text -