Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Step Through works but...

I have some code that shells out to a program, writes a pdf file and
then it is supposed to move the file from the programs default
location to a location specified in the macro. All of the code works
when I step through or if I add a pause of 1-2 seconds (Not currently
in the code below) but not in regular mode. I don't want to use the
wait statement because some of the files can take 20 seconds or more
to write and I don't want that long of a pause for smaller files. Can
anyone think why the file would not copy to the new location while
running the macro in regular mode? It writes the PDF to the default
location so the WEND loop is okay but it never copies the file over.
Thanks - Michael

Rem Run RMF report
FindIt = Dir("f:\axys3\pdf\" + filesavename + ".pdf")
If Not Len(FindIt) = 0 Then
Kill "f:\axys3\pdf\" + filesavename + ".pdf"
End If
If q4check < 4 Then
progID = Shell("f:\axys3\rep32.exe -mquarter -p" & ccm & " -u -s -vf -
t" & filesavename)

Else
If ccmdate inceptcutoff Then
progID = Shell("f:\axys3\rep32.exe -mqtr_eoy2 -p" & ccm & " -u -s -vf -
t" & filesavename)

Else
progID = Shell("f:\axys3\rep32.exe -mqtr_eoy -p" & ccm & " -u -s -vf -
t" & filesavename)
End If
End If



Rem Application.Run macro:="rmffile"

FindIt = Dir("f:\axys3\pdf\" + filesavename + ".pdf")
While Len(FindIt) = 0
FindIt = Dir("f:\axys3\pdf\" + filesavename + ".pdf")

Wend


progID = Shell("command.com /Ccopy f:\axys3\pdf\" + filesavename +
".pdf f:\perf\reports\" + perffolder)

FindIt = Dir("f:\perf\reports\" + perffolder + "\" + filesavename +
".pdf")
While Len(FindIt) = 0
FindIt = Dir("f:\perf\reports\" + perffolder + "\" + filesavename +
".pdf")
Wend
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Step Through works but...

I was doing some Excel to pdf stuff a few years ago; I did end up using a
wait (about 5s per file) but all my files were the same size and I could run
it overnight so I wasn't worried about the delay. IIRC, the PDF creator used
an internal 2-step process, so if I tried to move the PDFs right after
creation, it wouldn't find them (hence the step-through vs regular mode
difference). The pdf maker/distiller (at the time, several versions ago)
didn't allow me to pass a filename parameter, so I was forced to wait until
each file was created and move them before continuing. If I were attempting
the same thing today, I'd see if that has been updated- if you can give each
file a unique name, then just make an array of the source filenames and
where you want them to go, and do all your moves at the end. Alternatively,
rename your source Excel file (probably using a saveas) in a dummy
directory, do your print so it takes that filename for the pdf, then rename
your source file again, print another, etc... that way you can hopefully
force your pdf creator to produce the pdfs with different filenames (and
just go delete all the extra Excel files at the end of your run). Of course,
if your pdf creator uses a generic filename, then you may be stuck with a
wait statement.

HTH,
Keith

"mburkett" wrote in message
...
I have some code that shells out to a program, writes a pdf file and
then it is supposed to move the file from the programs default
location to a location specified in the macro. All of the code works
when I step through or if I add a pause of 1-2 seconds (Not currently
in the code below) but not in regular mode. I don't want to use the
wait statement because some of the files can take 20 seconds or more
to write and I don't want that long of a pause for smaller files. Can
anyone think why the file would not copy to the new location while
running the macro in regular mode? It writes the PDF to the default
location so the WEND loop is okay but it never copies the file over.
Thanks - Michael

Rem Run RMF report
FindIt = Dir("f:\axys3\pdf\" + filesavename + ".pdf")
If Not Len(FindIt) = 0 Then
Kill "f:\axys3\pdf\" + filesavename + ".pdf"
End If
If q4check < 4 Then
progID = Shell("f:\axys3\rep32.exe -mquarter -p" & ccm & " -u -s -vf -
t" & filesavename)

Else
If ccmdate inceptcutoff Then
progID = Shell("f:\axys3\rep32.exe -mqtr_eoy2 -p" & ccm & " -u -s -vf -
t" & filesavename)

Else
progID = Shell("f:\axys3\rep32.exe -mqtr_eoy -p" & ccm & " -u -s -vf -
t" & filesavename)
End If
End If



Rem Application.Run macro:="rmffile"

FindIt = Dir("f:\axys3\pdf\" + filesavename + ".pdf")
While Len(FindIt) = 0
FindIt = Dir("f:\axys3\pdf\" + filesavename + ".pdf")

Wend


progID = Shell("command.com /Ccopy f:\axys3\pdf\" + filesavename +
".pdf f:\perf\reports\" + perffolder)

FindIt = Dir("f:\perf\reports\" + perffolder + "\" + filesavename +
".pdf")
While Len(FindIt) = 0
FindIt = Dir("f:\perf\reports\" + perffolder + "\" + filesavename +
".pdf")
Wend



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Step-through works, Run does not? Othello Excel Programming 6 November 1st 06 02:13 PM
Macros: Step Thru Works, Run Works, Keyboard Shortcut Locks up BEEJAY Excel Programming 2 October 3rd 06 06:46 PM
It works when I step through it but it won't run chillihawk Excel Programming 5 June 5th 06 11:13 PM
macro works differently when using the Step Into (F8) feature Dave Y[_4_] Excel Programming 1 June 24th 05 03:06 AM
Works if I single step -\) Excel Programming 3 December 7th 04 04:24 PM


All times are GMT +1. The time now is 02:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"