One simple way is to ask the user the name of the output file BEFORE
you run the code.
Hence, the below would save the report to MyReprot.pdf in a dir of c:\mypdf
strOutPutDoc = "c:\myPdf\MyReprot.pdf"
strWhere = "City = 'Edmonton' "
DoCmd.OpenReport strReportName, acViewPreview, , strWhere
Reports(strReportName).Visible = False
Call ConvertReportToPDF(strReportName, , strDocName, False, False)
DoCmd.Close acReport, strReportName
So, just ask the user for the file name before you convernt, and then you
ask for the name, but set the dir
strMyDir = "c:\myPdf\"
strFileName = inputbox("what name to save reprot as")
..bla bla bla....
Call ConvertReportToPDF(strReportName, , strMyDir & strFileName, False,
False)
You can also modify the above code...and add a "initial" dir to the call...
You would have to add it to the above parameters..and then also to the
clsdialog call in the code, but
that would prompt the user for the file locates, and the above simply asks
for the file name.
Which road you go depends on if you trying to restrict what dir used for the
save...or just setting the start
dir for convenience sake...
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com