No worries, me being silly :(
If Dir(UCase(filestr & "Draft TEST" & "v" & count & ".pdf")) = "" Then
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=filestr & " Draft TEST" & "v" & count
notice the "SPACE" before the word "DRAFT" on the 2nd line, and not on the...
Thank you for your suggestion.
The code is not bringing any errors, it just overwrites the file it creates, (I can see that from the time stamp in windows explorer.
It is as if the loop is not working, but am unable to figure out why.
The first instance is naming the file correctly in the...
Thanks Andrzejek,
Your code works perfectly in my simple test version.
Unfortunately in my live version (with a little more coding etc) again appears to overwrite the file
My Live code is:
Dim Fnme As String
Dim Fpath As String
Dim filestr As String
Dim count As Integer
Dim bln As Boolean...
Thanks for the code.
Unfortunately, I am still only getting "test.pdf", therefore if the is a "Test.pdf" I am still unable to get "Testv1.pdf".
When testing, I am closing the file before attempting a "Testv1.pdf".
Any further ideas would be appreciated.
Thanks
Thanks Andy, that explains the problem,
Can you suggest a solution please?
I have tried
If Dir(filestr & "v" & count) = "" Then
ActiveSheet.ExportAsFixedFormat Type:=xltypepdf, filename:=filestr
Else
ActiveSheet.ExportAsFixedFormat Type:=xltypepdf, filename:=filestr & "v" &...
Sorry for appearing to not understand.
Using my second code is there a reason, for which I can not see, why the code is only increasing on version number when I don't close the file.
If that makes sense?
Thank you for your suggestion.
If I read your code correctly it appears to save the file as ".txt" and not ".pdf"
However I have slightly been able to develop my original code to
Sub SavePDF()
Static count As Integer
Dim filestr As String
filestr = "C:\Test"
Worksheets("Sheet2").Select
If...
Hi Guys
Sorry to bother you all, I have a little problem with some code I am working on.
I have an .xlsm file which I ExportAsFixedFormat to pdf, using the following code (this is only test version):
Worksheets("Sheet2").Select
ActiveSheet.ExportAsFixedFormat Type:=xltypepdf...
Hi All
I am trying to code an excel sheet whereby the code will add a watermark/shape, save the document, and then I need it to remove the watermark/shape.
So far I have the following code to add the watermark/shape
With ActiveSheet.Shapes.AddTextEffect(msoTextEffect1, "Draft", _...
Thanks Skip
Your code is great thanks, however it appears not to keep any cell colours.
I have managed to solve my problem (which keeps the formatting) with this code:
With ThisWorkbook
.Worksheets("Sheet2").Copy
Cells.Copy
Range("A1").PasteSpecial...
Hi Guys
Sorry about this, I have the following code (which works for what I want):
Sheets("Sheet2").Copy
Cells.Copy
Range("A1").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
ActiveWorkbook.SaveAs "C:\Test.xlsx"
ActiveWorkbook.Close
This...
Thankyou for your comment. Sorry maybe I was not clear enough.
What I am trying to do is in the *.xlsm file (where the macro is) copy Sheet2 as a value only and save it as a *.xls (or *.xlsx) file and then go back to the original *.xlsm file with sheet2 still having the formulas.
Is this...
Hello
Please can someone help me?
What I am trying to do is with the press of a button, copy sheet2 (which has formulas) as values only and then save that sheet as another file. But I need to keep the original sheet with the formulas.
My code (all beit test code) is:
Sub Button1_Click()...
Sorry,
Andy's code was perfect.
Sub Workbook_Open()
Dim s As Worksheet
Dim i As Integer
For Each s In Worksheets
Select Case s.Name
Case "April", "May", "June" 'etc
Case Else
Sheet26.ComboBox1.AddItem s.Name, I
i = i + 1
End Select...
Thanks Andy
Almost there, but sadly when I open the workbook, using that code I get an error message simply saying 'Invalid argument' and the option to debug, when I hit debug, the code:
.AddItem s.Name, I
is marked as yellow
the code I have used is:
Sub Workbook_Open()
Dim s...
Please can someone help?
I have the following code in a workbook of about 35 sheets:
Sub Workbook_Open()
Dim s As Worksheet
Dim varSelect
Dim i As Integer
i = 0
Sheet1.Activate
Set varSelect = Sheet26.ComboBox1
With varSelect
For Each s In Worksheets...
Hello
I am trying to work out a formula in excel that can narrow down a 4 week and say 2 day working month into 4 weeks. So if 30th and 31st would be in week 1 of the following month (along with 1,2, and 3rd) therefore Monday 6th would be Week 2.
I currently have the following formula...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.