Saving pdf

jebenexcel

Board Regular
Joined
Mar 16, 2018
Messages
59
Code:
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="[I]path[/I]" & Firma & "\Offers\" & "OBR1_" & broj & "_" & Firma & "_" & Format(Now(), "dd.mm.yyyy") & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False

path is juts your regular C:\etc path... getting an error 1004 on this... Why?
Firma is a string, broj is a number.
 
Last edited:

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

yky

Well-known Member
Joined
Jun 7, 2011
Messages
1,880
Office Version
  1. 2010
Platform
  1. Windows
If path is a string, you don't need to enclose it with double quotes.

What do you see in the debug window if you monitor the following expression?
"path" & Firma & "\Offers" & "OBR1_" & broj & "_" & Firma & "_" & Format(Now(), "dd.mm.yyyy") & ".pdf"
 

jebenexcel

Board Regular
Joined
Mar 16, 2018
Messages
59
Runtime error 1004;
Document not saved. The document may be open, or an error may have been encountered while saving.
 

yky

Well-known Member
Joined
Jun 7, 2011
Messages
1,880
Office Version
  1. 2010
Platform
  1. Windows
Remove the two double quotes enclosing the word "path" then run the code. What do you get?
 

jebenexcel

Board Regular
Joined
Mar 16, 2018
Messages
59

ADVERTISEMENT

path is not a variable, it is the actual path in ""
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
74,374
Office Version
  1. 365
Platform
  1. Windows
If Path is not a variable, then you need to remove it & put in the actual path
 

yky

Well-known Member
Joined
Jun 7, 2011
Messages
1,880
Office Version
  1. 2010
Platform
  1. Windows
Press F8 to step through the code line by line and monitor the following expression in the debug window. What does it show before the code in #1 is executed?

"path" & Firma & "\Offers" & "OBR1_" & broj & "_" & Firma & "_" & Format(Now(), "dd.mm.yyyy") & ".pdf"
 
Last edited:
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,167,063
Messages
5,851,872
Members
431,470
Latest member
mikaelaleksandrowicz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top