Posted to microsoft.public.excel.programming
|
|
Setting Up References in the VBE
Albert,
One way is to check the registry key
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts
NickHK
"Albert" wrote in message
...
Hi NickHK,
I finally nailed it quite nicely with PrintToFile=True
Do you know some way to get a list of the available printers?
Regards,
Albert C
Dim FaxServ As FAXCOMLib.FaxServer
Dim FaxDoc As FAXCOMLib.FaxDoc
Sub AutoFaxer()
Application.ActivePrinter = "Fax en Ne01:"
ActiveSheet.PrintOut , , , , , True, , ThisWorkbook.Path &
"\PrintToFileAlbert.tiff"
Set FaxServ = New FAXCOMLib.FaxServer
FaxServ.Connect Environ("AlbertoCattan")
Set FaxDoc = FaxServ.CreateDocument("C:\fax.tiff")
With FaxDoc
.Filename = ThisWorkbook.Path & "\PrintToFileAlbert.tiff"
.FaxNumber = "9,012345678"
.Send
End With
End Sub
"NickHK" wrote:
Albert,
If you do not want to use Print to a fax (like WinFax), then you would
have
to save the range to a file first.
Here's one of the many that export a range to a graphics format ;
http://j-walk.com/ss/pup/pup6/features.htm
Then fax that output.
NickHK
"Albert" wrote in message
...
Hi NickHK,
Thank you so much... That was very cool stuff and now it did work.
However, it only works if "c:\test.txt" exists. How would I go about
sending
the PrintArea in my current workbook?
Thanks again and best regards,
Albert C
"NickHK" wrote:
Albert,
Using W2K, so can't tell you about other OSs.
First time I tried it, but this works, at least the sending fax and
Fax
queue dialogs comes up, but then I cancel, as I don't have a number
to
send
a fax at the moment.
I assume you have a modem installed and it is able to send faxes.
I have Winfax installed, so I know my modem is OK.
Make sure you do not have the fax service disabled; Control
PanelAdmin
ToolsServicesFax Service, either Manual or Automatic.
Dim FaxServ As FAXCOMLib.FaxServer
Dim FaxDoc As FAXCOMLib.FaxDoc
Private Sub CommandButton1_Click()
Set FaxServ = New FAXCOMLib.FaxServer
FaxServ.Connect Environ("ComputerName")
Set FaxDoc = FaxServ.CreateDocument("C:\fax.tiff")
With FaxDoc
.Filename = "c:\test.txt"
.FaxNumber = "5555551212"
.Send
End With
End Sub
NickHK
"Albert" wrote in message
...
Thanks. Its a little bit confusing, but I'm starting to play with
it
to
see
if I can get something out of it. No luck so far though. The code
executes
well and I am no longer getting an error message, but the code
doesn't
seem
to do anything.
I added FaxDoc.Send at the end and I got a -2147024864 Error
message.
I'm kind of new to this whole Reference thing.
Regards,
Albert C
"NickHK" wrote:
Albert,
This should get you started ;
http://www.codeguru.com/forum/archiv.../t-259837.html
NickHK
"Albert" wrote in message
...
Hi NickHK.
I've tried these:
faxcom1.0 Type Library
FaxControl1.0 Type Library
Microsoft Fax Service Extended COM Type Library
I also tried to set up a reference to
Windows/System32/WinFax.dll
but
I
get
an error message.
Thanks in advance,
Albert C
"NickHK" wrote:
Albert,
Which component are you using ?
NickHK
"Albert" wrote in message
...
Hello!
I'm trying to send a FAX through VBA without getting the
Send
Fax
Dialog
Box
that asks for the number to dial, etc...
I read on a previous thread that I had to set up a
reference
to
the
Fax
software.
I found a couple of libraries that had something to do
with
faxes.
However, I'm swamped in trying to control them.
I see some of the classes and members in the Object
Explorer
in
VBE,
but I
can't get anything to work.
Perhaps someone has done this?
Help would be very much appreciated.
Albert C
|