473,385 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Quick fix for saving Excel files as PDF files - VB.NET

I've seen a few posts on other sites discussing how to save an excel file, word file, or other office doc as a pdf document.

In general, seems the solutions have been pretty complicated or involved trying unsuccessfully to use the undocumented AdobePDFMakerForOffice class.

One quick fix that could save time for others, and is not too difficult, is to use the Execute() method of the Excel.Application.CommandBars class. It's definitely a work-around and has some limitations, but can be useful:

<your excel object>.Application.CommandBars(<excel command bar index - usually 1>).Controls(<adobepdfmaker menu index within excel>).Controls(<convert to adobe pdf option indexwithin menu>).Execute()

Using this, it's a one line solution, although just be sure to take limitations into account:
- Have the PDF Maker installed in your office apps and as a menu bar item
- Be sure the setting to "prompt for filename" is unchecked
- Remember to reference the proper command bar and command bar items
- Have to save the doc at least once before executing PDF in order to avoid a prompt/need for PDF Maker to request a filename

Hope this helps others.
Jul 25 '07 #1
1 3183
Don't have any affiliation with Aspose, but their Components are great if it comes to Office functionality on the server. They have an Excel Component too.
Jul 25 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Jan Nordgreen | last post by:
The following code only generates the first csv file. The second request is just ignored. What am I doing wrong? I am using Mozilla Firefox, Windows XP, and Xampp. <?php require...
4
by: Victor Engmark | last post by:
Background: People want to be able to record large amounts of product data ("a few MB") on laptop or tablet PCs without _any_ kind of network connection, and then to submit the data to a database...
1
by: Richard Holliingsworth | last post by:
Hello: Thanks for your quick response. I'm trying to import a new Excel file into an A2K table and it's truncating the data. One of the Excel columns is a text field that can be up to 2000...
6
by: gizmo | last post by:
I have a requirement to initiate more than one instance of an application using the filenames. (the example below will start two instances of MS Word). My problem is that I need to kill each...
12
by: Ron Weldy | last post by:
I have a test server runinng 2003/IIS 6 with a mixture of asp and asp.net files. On my workstation I have a share set up to the folder where the web files reside. I am just doing quick and dirty...
0
by: Kewal | last post by:
Hi All, I have a requirement of saving Excel files as HTML using C#. I have managed to write code for saving as HTLM file. however this seems to be not working in the once perticular case . ...
0
by: Speilman_54 | last post by:
Hi, I'm converting an excel Macro into visual basic 2005 express, as I don't have a copy of VB 6 and trying to make and executable from it, I know this version doesn't have the save file as .exe,...
6
by: Karl | last post by:
Hi all, It may seem like a rather odd request (or not) but I would like to be able to create a file (doc, jpg, xls or one of many other files that can be automated) on a website and stream it to...
6
by: Eddie | last post by:
Hi all, I am displaying a number of reports, and giving the users an option to display them on the web or download them to Excel. If they want the Excel file, I just use the PHP header command...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.