Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-19-2014, 06:41 AM
EnigmaMatter EnigmaMatter is offline Save As PDF from UserForm Issue Windows 7 32bit Save As PDF from UserForm Issue Office 2010 32bit
Novice
Save As PDF from UserForm Issue
 
Join Date: Sep 2014
Posts: 6
EnigmaMatter is on a distinguished road
Default Save As PDF from UserForm Issue

Hello,



Essentially, the UserForm that loads when the Document is opened allows you to save the document as a PDF if the PDFCheck (CheckBox) is selected.

All of the VBA works as intended if you execute from the Console. However, the UserForm does not seem to execute the SaveAsPDF Sub when the UserForm first loads.

Why?

I have attached an example of the document.
Attached Files
File Type: doc FOR POSTING.doc (38.8 KB, 13 views)
Reply With Quote
  #2  
Old 09-19-2014, 11:32 PM
gmayor's Avatar
gmayor gmayor is offline Save As PDF from UserForm Issue Windows 7 64bit Save As PDF from UserForm Issue Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The principal reason is that the form is named frm in the calling code:
Dim frm As New BOSForm
but you have referred to it as BOSForm in the form code, and as that doesn't effectively exist, the code is ignored.

Your userform doesn't display the check box fully, and it has no cancel button. Both are addressed in the attached.

I was puzzled how you were able to use content controls in a DOC format document, until I checked and found that this is a DOCM format document with the extension renamed as DOC. There is no good reason (apart from enabling it to be attached to a message in this forum) to do this and it can cause problems, so use the correct extension (and use zip to attach it).

The attached does create the PDF.
Attached Files
File Type: zip FOR POSTING.zip (34.9 KB, 15 views)
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 09-20-2014, 04:59 AM
EnigmaMatter EnigmaMatter is offline Save As PDF from UserForm Issue Windows 7 32bit Save As PDF from UserForm Issue Office 2010 32bit
Novice
Save As PDF from UserForm Issue
 
Join Date: Sep 2014
Posts: 6
EnigmaMatter is on a distinguished road
Default

Wow! Thank you for the important tip that I will use in many situations.

Didn't even think of a Cancel button.


Yes, the only reason I changed the extension was for upload to this forum.
Reply With Quote
  #4  
Old 09-20-2014, 05:06 AM
EnigmaMatter EnigmaMatter is offline Save As PDF from UserForm Issue Windows 7 32bit Save As PDF from UserForm Issue Office 2010 32bit
Novice
Save As PDF from UserForm Issue
 
Join Date: Sep 2014
Posts: 6
EnigmaMatter is on a distinguished road
Default

I will post a new thread if appropriate , but the other issue I am having is that the PDF document doesn't save in the same location as the source file. What did I do wrong?
Reply With Quote
  #5  
Old 09-20-2014, 05:14 AM
gmayor's Avatar
gmayor gmayor is offline Save As PDF from UserForm Issue Windows 7 64bit Save As PDF from UserForm Issue Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

I modified the PDF module so that it should now save to the same folder as the document, unless you are using the document as a template in which case the new document won't have a path. If you are doing that either save the document first, or change the line
strFilename = ActiveDocument.Path & _
to
strFilename = ThisDocument.Path & _
which will save the PDF in the same folder as the 'template'.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #6  
Old 09-20-2014, 05:42 AM
EnigmaMatter EnigmaMatter is offline Save As PDF from UserForm Issue Windows 7 32bit Save As PDF from UserForm Issue Office 2010 32bit
Novice
Save As PDF from UserForm Issue
 
Join Date: Sep 2014
Posts: 6
EnigmaMatter is on a distinguished road
Default

Thanks! I am using Tapatalk to use this forum, can I get on the PC to mark as solved or give you points? I am relatively new to the forum.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Save As PDF from UserForm Issue Can't save userform macro from 2003 to 2010 billy8b8 Word VBA 1 07-26-2014 07:58 PM
Save As PDF from UserForm Issue Is it possible to take an input from a UserForm in one document to a UserForm in a do BoringDavid Word VBA 5 05-09-2014 09:08 AM
Save As PDF from UserForm Issue When I try to save an existing word doc, save as pops up and will not save... samanthab Word 3 01-19-2013 06:27 AM
Save As PDF from UserForm Issue PPT save issue - can't restore previous copy? GrahamBerry PowerPoint 1 04-23-2012 10:33 AM
Microsoft Excel Save As Address Bar Issue Kazuma5201 Excel 0 11-03-2011 08:58 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:18 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft