Hi!
I was able to create an invoicing excel file because of the help of all you awesome people from this forum.
But I would like some help again. Please don't hate me if I am confusing, since I am confusing my self too, with what I want to happen.
So is it possible to like
Source File.xlsm>Sheet1>A1 <------ Where the invoice number is
Client File A.xlsm>sheet1>A1 <------ Invoice Number from (Source File.xlsm>Sheet1>A1) + 1 when I click my Export Button (Saves as PDF and save to clients respective folder)
This is the current code I have:
Sub Rectangle1_Click()
Dim sFullName As String
Dim Ans As Long
Dim bSavePDF As Boolean
Worksheets("INV#").Range("A1").Value = Worksheets("INV#").Range("A1").Value + 1
sFullName = "C:\Invoice\Client A" & Range("A2").Value
Do
If Len(Dir(sFullName, vbNormal)) = 0 Then
bSavePDF = True
Else
Ans = MsgBox("File already exists. Overwirte?", vbQuestion + vbYesNoCancel, "Overwrite?")
Select Case Ans
Case vbYes
bSavePDF = True
Case vbNo
sFullName = Application.GetSaveAsFilename(InitialFileName:=sFullName, _
FileFilter:="PDF (*.pdf), *.pdf", Title:="Save As", ButtonText:="Save")
If sFullName = "False" Then Exit Sub
Case vbCancel
Exit Sub
End Select
End If
Loop Until bSavePDF
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=sFullName, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=True
End Sub
I really hope I did not confuse you or make you guys mad.
Thank you in advance!
I was able to create an invoicing excel file because of the help of all you awesome people from this forum.
But I would like some help again. Please don't hate me if I am confusing, since I am confusing my self too, with what I want to happen.
So is it possible to like
Source File.xlsm>Sheet1>A1 <------ Where the invoice number is
Client File A.xlsm>sheet1>A1 <------ Invoice Number from (Source File.xlsm>Sheet1>A1) + 1 when I click my Export Button (Saves as PDF and save to clients respective folder)
This is the current code I have:
Sub Rectangle1_Click()
Dim sFullName As String
Dim Ans As Long
Dim bSavePDF As Boolean
Worksheets("INV#").Range("A1").Value = Worksheets("INV#").Range("A1").Value + 1
sFullName = "C:\Invoice\Client A" & Range("A2").Value
Do
If Len(Dir(sFullName, vbNormal)) = 0 Then
bSavePDF = True
Else
Ans = MsgBox("File already exists. Overwirte?", vbQuestion + vbYesNoCancel, "Overwrite?")
Select Case Ans
Case vbYes
bSavePDF = True
Case vbNo
sFullName = Application.GetSaveAsFilename(InitialFileName:=sFullName, _
FileFilter:="PDF (*.pdf), *.pdf", Title:="Save As", ButtonText:="Save")
If sFullName = "False" Then Exit Sub
Case vbCancel
Exit Sub
End Select
End If
Loop Until bSavePDF
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=sFullName, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=True
End Sub
I really hope I did not confuse you or make you guys mad.
Thank you in advance!